@dcloudio/uni-cli-shared 3.0.0-3090620231104002 → 3.0.0-3090820231124001
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 +1 -0
- package/dist/constants.js +3 -2
- package/dist/json/app/manifest/nvue.d.ts +1 -1
- package/dist/json/pages.js +19 -14
- package/dist/preprocess/context.js +10 -6
- package/dist/uni_modules.js +12 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +6 -1
- package/dist/uts.js +17 -8
- package/dist/vite/autoImport.d.ts +3 -0
- package/dist/vite/autoImport.js +105 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/dist/vite/plugins/index.d.ts +2 -2
- package/dist/vite/plugins/index.js +2 -2
- package/dist/vite/plugins/uts/{app.d.ts → uni_modules.d.ts} +2 -1
- package/dist/vite/plugins/uts/{app.js → uni_modules.js} +5 -4
- package/dist/vite/plugins/uts/uvue.d.ts +2 -0
- package/dist/vite/plugins/uts/{h5.js → uvue.js} +4 -4
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +3 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +12 -5
- package/package.json +5 -4
- package/dist/vite/plugins/uts/h5.d.ts +0 -2
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const PUBLIC_DIR = "static";
|
|
2
2
|
export declare const EXTNAME_JS: string[];
|
|
3
|
+
export declare const X_EXTNAME_JS: string[];
|
|
3
4
|
export declare const EXTNAME_TS: string[];
|
|
4
5
|
export declare const EXTNAME_VUE: string[];
|
|
5
6
|
export declare const X_EXTNAME_VUE: string[];
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.X_PAGE_EXTNAME_APP = exports.X_PAGE_EXTNAME = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.uni_app_x_extensions = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.X_EXTNAME_VUE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
3
|
+
exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.X_PAGE_EXTNAME_APP = exports.X_PAGE_EXTNAME = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.uni_app_x_extensions = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.X_EXTNAME_VUE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.X_EXTNAME_JS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
4
4
|
exports.PUBLIC_DIR = 'static';
|
|
5
5
|
exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
|
|
6
|
+
exports.X_EXTNAME_JS = ['.uts', ...exports.EXTNAME_JS];
|
|
6
7
|
exports.EXTNAME_TS = ['.ts', '.tsx'];
|
|
7
8
|
exports.EXTNAME_VUE = ['.vue', '.nvue', '.uvue'];
|
|
8
9
|
exports.X_EXTNAME_VUE = ['.uvue', '.vue'];
|
|
@@ -38,7 +39,7 @@ exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
|
|
|
38
39
|
exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js'];
|
|
39
40
|
// 其他平台解析页面后缀的优先级
|
|
40
41
|
exports.PAGE_EXTNAME = ['.vue', '.nvue', '.tsx', '.jsx', '.js'];
|
|
41
|
-
exports.X_PAGE_EXTNAME = ['.
|
|
42
|
+
exports.X_PAGE_EXTNAME = ['.uvue', '.vue', '.tsx', '.jsx', '.js'];
|
|
42
43
|
exports.X_PAGE_EXTNAME_APP = ['.uvue', '.tsx', '.jsx', '.js'];
|
|
43
44
|
exports.H5_API_STYLE_PATH = '@dcloudio/uni-h5/style/api/';
|
|
44
45
|
exports.H5_FRAMEWORK_STYLE_PATH = '@dcloudio/uni-h5/style/framework/';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function initNVue(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
|
|
2
|
-
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "
|
|
2
|
+
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "vue" | "weex" | "vite";
|
|
3
3
|
export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "uni-app" | "weex";
|
|
4
4
|
export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "column" | "row" | "row-reverse" | "column-reverse";
|
package/dist/json/pages.js
CHANGED
|
@@ -194,23 +194,28 @@ function normalizeSubpackageSubNVues(root, style = { navigationBar: {} }) {
|
|
|
194
194
|
return style;
|
|
195
195
|
}
|
|
196
196
|
function normalizePageStyle(pagePath, pageStyle, platform) {
|
|
197
|
-
const hasNVue = pagePath &&
|
|
198
|
-
process.env.UNI_INPUT_DIR &&
|
|
199
|
-
fs_1.default.existsSync(path_1.default.join(process.env.UNI_INPUT_DIR, pagePath + '.nvue'))
|
|
200
|
-
? true
|
|
201
|
-
: undefined;
|
|
202
197
|
let isNVue = false;
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
198
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
199
|
+
isNVue = undefined;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const hasNVue = pagePath &&
|
|
203
|
+
process.env.UNI_INPUT_DIR &&
|
|
204
|
+
fs_1.default.existsSync(path_1.default.join(process.env.UNI_INPUT_DIR, pagePath + '.nvue'))
|
|
205
|
+
? true
|
|
206
|
+
: undefined;
|
|
207
|
+
if (hasNVue) {
|
|
208
|
+
const hasVue = fs_1.default.existsSync(path_1.default.join(process.env.UNI_INPUT_DIR, pagePath + '.vue'));
|
|
209
|
+
if (hasVue) {
|
|
210
|
+
if (platform === 'app') {
|
|
211
|
+
if (process.env.UNI_NVUE_COMPILER !== 'vue') {
|
|
212
|
+
isNVue = true;
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
else {
|
|
217
|
+
isNVue = true;
|
|
218
|
+
}
|
|
214
219
|
}
|
|
215
220
|
}
|
|
216
221
|
if (pageStyle) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initPreContext = exports.getPreUVueContext = exports.getPreNVueContext = exports.getPreVueContext = void 0;
|
|
4
|
-
const
|
|
4
|
+
const extend = Object.assign;
|
|
5
|
+
const isString = (val) => typeof val === 'string';
|
|
6
|
+
const objectToString = Object.prototype.toString;
|
|
7
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
8
|
+
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
5
9
|
const DEFAULT_KEYS = [
|
|
6
10
|
'UNI_APP_X',
|
|
7
11
|
'APP',
|
|
@@ -88,21 +92,21 @@ function initPreContext(platform, userPreContext, utsPlatform, isX) {
|
|
|
88
92
|
defaultContext.WEB = true;
|
|
89
93
|
}
|
|
90
94
|
if (userPreContext) {
|
|
91
|
-
if (
|
|
95
|
+
if (isString(userPreContext)) {
|
|
92
96
|
try {
|
|
93
97
|
userPreContext = JSON.parse(userPreContext);
|
|
94
98
|
}
|
|
95
99
|
catch (e) { }
|
|
96
100
|
}
|
|
97
|
-
if (
|
|
101
|
+
if (isPlainObject(userPreContext)) {
|
|
98
102
|
Object.keys(userPreContext).forEach((key) => {
|
|
99
103
|
defaultContext[normalizeKey(key)] = !!userPreContext[key];
|
|
100
104
|
});
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
extend(preVueContext, defaultContext, vueContext);
|
|
108
|
+
extend(preNVueContext, defaultContext, nvueContext);
|
|
109
|
+
extend(preUVueContext, defaultContext, uvueContext);
|
|
106
110
|
}
|
|
107
111
|
exports.initPreContext = initPreContext;
|
|
108
112
|
function normalizeKey(name) {
|
package/dist/uni_modules.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseInjects = exports.parseUniExtApis = void 0;
|
|
7
|
+
// 重要:此文件编译后的js,需同步至 vue2 编译器中 uni-cli-shared/lib/uts/uni_modules.js
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
10
|
function parseUniExtApis(vite = true, platform, language = 'javascript') {
|
|
@@ -63,6 +64,9 @@ exports.parseUniExtApis = parseUniExtApis;
|
|
|
63
64
|
* @returns
|
|
64
65
|
*/
|
|
65
66
|
function parseInjects(vite = true, platform, language, source, uniModuleRootDir, exports = {}) {
|
|
67
|
+
if (platform === 'app-plus') {
|
|
68
|
+
platform = 'app';
|
|
69
|
+
}
|
|
66
70
|
let rootDefines = {};
|
|
67
71
|
Object.keys(exports).forEach((name) => {
|
|
68
72
|
if (name.startsWith('uni')) {
|
|
@@ -71,10 +75,17 @@ function parseInjects(vite = true, platform, language, source, uniModuleRootDir,
|
|
|
71
75
|
});
|
|
72
76
|
const injects = {};
|
|
73
77
|
if (Object.keys(rootDefines).length) {
|
|
74
|
-
|
|
78
|
+
let hasPlatformFile = uniModuleRootDir
|
|
75
79
|
? fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'index.uts')) ||
|
|
76
80
|
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', platform))
|
|
77
81
|
: true;
|
|
82
|
+
if (!hasPlatformFile) {
|
|
83
|
+
if (platform === 'app') {
|
|
84
|
+
hasPlatformFile =
|
|
85
|
+
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-android')) ||
|
|
86
|
+
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-ios'));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
78
89
|
for (const key in rootDefines) {
|
|
79
90
|
Object.assign(injects, parseInject(vite, platform, language, source, 'uni', rootDefines[key], hasPlatformFile));
|
|
80
91
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as hash } from 'hash-sum';
|
|
|
2
2
|
import { ElementNode, RootNode, TemplateChildNode } from '@vue/compiler-core';
|
|
3
3
|
import { ParserPlugin } from '@babel/parser';
|
|
4
4
|
export declare const version: any;
|
|
5
|
+
export { camelize, capitalize, isArray } from '@vue/shared';
|
|
5
6
|
export declare let isRunningWithYarnPnp: boolean;
|
|
6
7
|
export declare const isWindows: boolean;
|
|
7
8
|
export declare function normalizePath(id: string): 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.resolveAppVue = exports.isAppVue = exports.installDepTips = 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.version = exports.hash = void 0;
|
|
6
|
+
exports.resolveAppVue = exports.isAppVue = exports.installDepTips = 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.isArray = exports.capitalize = exports.camelize = exports.version = 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"));
|
|
@@ -14,6 +14,11 @@ Object.defineProperty(exports, "hash", { enumerable: true, get: function () { re
|
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
15
|
const platform_1 = require("./platform");
|
|
16
16
|
exports.version = require('../package.json').version;
|
|
17
|
+
// 专为 uts.ts 服务
|
|
18
|
+
var shared_2 = require("@vue/shared");
|
|
19
|
+
Object.defineProperty(exports, "camelize", { enumerable: true, get: function () { return shared_2.camelize; } });
|
|
20
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return shared_2.capitalize; } });
|
|
21
|
+
Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return shared_2.isArray; } });
|
|
17
22
|
try {
|
|
18
23
|
exports.isRunningWithYarnPnp = Boolean(require('pnpapi'));
|
|
19
24
|
}
|
package/dist/uts.js
CHANGED
|
@@ -7,11 +7,20 @@ exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce =
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
|
-
const shared_1 = require("@vue/shared");
|
|
11
10
|
const hbx_1 = require("./hbx");
|
|
12
11
|
const utils_1 = require("./utils");
|
|
13
|
-
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
14
12
|
const uni_modules_1 = require("./uni_modules");
|
|
13
|
+
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
14
|
+
function once(fn, ctx = null) {
|
|
15
|
+
let res;
|
|
16
|
+
return ((...args) => {
|
|
17
|
+
if (fn) {
|
|
18
|
+
res = fn.apply(ctx, args);
|
|
19
|
+
fn = null;
|
|
20
|
+
}
|
|
21
|
+
return res;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
15
24
|
/**
|
|
16
25
|
* 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
|
|
17
26
|
* @param id
|
|
@@ -114,7 +123,7 @@ function parseUTSComponent(name, type) {
|
|
|
114
123
|
const meta = utsComponents.get(name);
|
|
115
124
|
if (meta) {
|
|
116
125
|
const namespace = meta[type === 'swift' ? 'swiftModule' : 'kotlinPackage'] || '';
|
|
117
|
-
const className = (0,
|
|
126
|
+
const className = (0, utils_1.capitalize)((0, utils_1.camelize)(name)) + 'Component';
|
|
118
127
|
return {
|
|
119
128
|
className,
|
|
120
129
|
namespace,
|
|
@@ -209,16 +218,16 @@ function prefix(id) {
|
|
|
209
218
|
return id;
|
|
210
219
|
}
|
|
211
220
|
function parseKotlinPackageWithPluginId(id, is_uni_modules) {
|
|
212
|
-
return 'uts.sdk.' + (is_uni_modules ? 'modules.' : '') + (0,
|
|
221
|
+
return 'uts.sdk.' + (is_uni_modules ? 'modules.' : '') + (0, utils_1.camelize)(prefix(id));
|
|
213
222
|
}
|
|
214
223
|
exports.parseKotlinPackageWithPluginId = parseKotlinPackageWithPluginId;
|
|
215
224
|
function parseSwiftPackageWithPluginId(id, is_uni_modules) {
|
|
216
225
|
return ('UTSSDK' +
|
|
217
226
|
(is_uni_modules ? 'Modules' : '') +
|
|
218
|
-
(0,
|
|
227
|
+
(0, utils_1.capitalize)((0, utils_1.camelize)(prefix(id))));
|
|
219
228
|
}
|
|
220
229
|
exports.parseSwiftPackageWithPluginId = parseSwiftPackageWithPluginId;
|
|
221
|
-
exports.parseUniExtApiNamespacesOnce =
|
|
230
|
+
exports.parseUniExtApiNamespacesOnce = once((platform, language) => {
|
|
222
231
|
const extApis = (0, exports.parseUniExtApiNamespacesJsOnce)(platform, language);
|
|
223
232
|
const namespaces = {};
|
|
224
233
|
Object.keys(extApis).forEach((name) => {
|
|
@@ -235,12 +244,12 @@ exports.parseUniExtApiNamespacesOnce = (0, uni_shared_1.once)((platform, languag
|
|
|
235
244
|
});
|
|
236
245
|
return namespaces;
|
|
237
246
|
});
|
|
238
|
-
exports.parseUniExtApiNamespacesJsOnce =
|
|
247
|
+
exports.parseUniExtApiNamespacesJsOnce = once((platform, language) => {
|
|
239
248
|
const extApis = (0, uni_modules_1.parseUniExtApis)(true, platform, language);
|
|
240
249
|
const namespaces = {};
|
|
241
250
|
Object.keys(extApis).forEach((name) => {
|
|
242
251
|
const options = extApis[name];
|
|
243
|
-
if ((0,
|
|
252
|
+
if ((0, utils_1.isArray)(options) && options.length >= 2) {
|
|
244
253
|
namespaces[name.replace('uni.', '')] = [options[0], options[1]];
|
|
245
254
|
}
|
|
246
255
|
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initAutoImportOptions = void 0;
|
|
4
|
+
const uniPreset = {
|
|
5
|
+
from: '@dcloudio/uni-app',
|
|
6
|
+
imports: [
|
|
7
|
+
// uni-app lifecycle
|
|
8
|
+
// App and Page
|
|
9
|
+
'onShow',
|
|
10
|
+
'onHide',
|
|
11
|
+
// App
|
|
12
|
+
'onAppShow',
|
|
13
|
+
'onLaunch',
|
|
14
|
+
'onError',
|
|
15
|
+
'onThemeChange',
|
|
16
|
+
'onKeyboardHeightChange',
|
|
17
|
+
'onPageNotFound',
|
|
18
|
+
'onUnhandledRejection',
|
|
19
|
+
'onLastPageBackPress',
|
|
20
|
+
'onExit',
|
|
21
|
+
// Page
|
|
22
|
+
'onLoad',
|
|
23
|
+
'onReady',
|
|
24
|
+
'onUnload',
|
|
25
|
+
'onResize',
|
|
26
|
+
'onBackPress',
|
|
27
|
+
'onPageScroll',
|
|
28
|
+
'onTabItemTap',
|
|
29
|
+
'onReachBottom',
|
|
30
|
+
'onPullDownRefresh',
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
const cloudPreset = {
|
|
34
|
+
'@dcloudio/uni-cloud': [['default', 'uniCloud']],
|
|
35
|
+
};
|
|
36
|
+
const vuePreset = {
|
|
37
|
+
from: 'vue',
|
|
38
|
+
imports: [
|
|
39
|
+
// vue lifecycle
|
|
40
|
+
'onActivated',
|
|
41
|
+
'onBeforeMount',
|
|
42
|
+
'onBeforeUnmount',
|
|
43
|
+
'onBeforeUpdate',
|
|
44
|
+
'onErrorCaptured',
|
|
45
|
+
'onDeactivated',
|
|
46
|
+
'onMounted',
|
|
47
|
+
'onServerPrefetch',
|
|
48
|
+
'onUnmounted',
|
|
49
|
+
'onUpdated',
|
|
50
|
+
// setup helpers
|
|
51
|
+
'useAttrs',
|
|
52
|
+
'useSlots',
|
|
53
|
+
// reactivity,
|
|
54
|
+
'computed',
|
|
55
|
+
'customRef',
|
|
56
|
+
'isReadonly',
|
|
57
|
+
'isRef',
|
|
58
|
+
'isProxy',
|
|
59
|
+
'isReactive',
|
|
60
|
+
'markRaw',
|
|
61
|
+
'reactive',
|
|
62
|
+
'readonly',
|
|
63
|
+
'ref',
|
|
64
|
+
'shallowReactive',
|
|
65
|
+
'shallowReadonly',
|
|
66
|
+
'shallowRef',
|
|
67
|
+
'triggerRef',
|
|
68
|
+
'toRaw',
|
|
69
|
+
'toRef',
|
|
70
|
+
'toRefs',
|
|
71
|
+
'toValue',
|
|
72
|
+
'unref',
|
|
73
|
+
'watch',
|
|
74
|
+
'watchEffect',
|
|
75
|
+
'watchPostEffect',
|
|
76
|
+
'watchSyncEffect',
|
|
77
|
+
// component
|
|
78
|
+
'defineComponent',
|
|
79
|
+
'defineAsyncComponent',
|
|
80
|
+
'getCurrentInstance',
|
|
81
|
+
'h',
|
|
82
|
+
'inject',
|
|
83
|
+
'nextTick',
|
|
84
|
+
'provide',
|
|
85
|
+
'useCssModule',
|
|
86
|
+
'createApp',
|
|
87
|
+
// effect scope
|
|
88
|
+
'effectScope',
|
|
89
|
+
'EffectScope',
|
|
90
|
+
'getCurrentScope',
|
|
91
|
+
'onScopeDispose',
|
|
92
|
+
// types 全部全局导入
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
|
|
96
|
+
return {
|
|
97
|
+
...userOptions,
|
|
98
|
+
include: [/\.[u]?ts$/, /\.[u]?vue$/, /\.[u]?vue\?vue/],
|
|
99
|
+
imports: imports.concat(
|
|
100
|
+
// app-android 平台暂不注入其他
|
|
101
|
+
platform === 'app-android' ? [] : [uniPreset, cloudPreset, vuePreset]),
|
|
102
|
+
dts: false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
exports.initAutoImportOptions = initAutoImportOptions;
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
|
@@ -5,8 +5,8 @@ export * from './mainJs';
|
|
|
5
5
|
export * from './jsonJs';
|
|
6
6
|
export * from './console';
|
|
7
7
|
export * from './dynamicImportPolyfill';
|
|
8
|
-
export * from './uts/
|
|
9
|
-
export * from './uts/
|
|
8
|
+
export * from './uts/uni_modules';
|
|
9
|
+
export * from './uts/uvue';
|
|
10
10
|
export { assetPlugin, parseAssets, getAssetHash } from './vitejs/plugins/asset';
|
|
11
11
|
export { isCSSRequest, cssPlugin, cssPostPlugin, minifyCSS, cssLangRE, commonjsProxyRE, } from './vitejs/plugins/css';
|
|
12
12
|
export { generateCodeFrame, locToStartAndEnd } from './vitejs/utils';
|
|
@@ -22,8 +22,8 @@ __exportStar(require("./mainJs"), exports);
|
|
|
22
22
|
__exportStar(require("./jsonJs"), exports);
|
|
23
23
|
__exportStar(require("./console"), exports);
|
|
24
24
|
__exportStar(require("./dynamicImportPolyfill"), exports);
|
|
25
|
-
__exportStar(require("./uts/
|
|
26
|
-
__exportStar(require("./uts/
|
|
25
|
+
__exportStar(require("./uts/uni_modules"), exports);
|
|
26
|
+
__exportStar(require("./uts/uvue"), exports);
|
|
27
27
|
var asset_1 = require("./vitejs/plugins/asset");
|
|
28
28
|
Object.defineProperty(exports, "assetPlugin", { enumerable: true, get: function () { return asset_1.assetPlugin; } });
|
|
29
29
|
Object.defineProperty(exports, "parseAssets", { enumerable: true, get: function () { return asset_1.parseAssets; } });
|
|
@@ -2,7 +2,8 @@ import type { Plugin } from 'vite';
|
|
|
2
2
|
interface UniUTSPluginOptions {
|
|
3
3
|
x?: boolean;
|
|
4
4
|
extApis?: Record<string, [string, string]>;
|
|
5
|
+
isSingleThread?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const utsPlugins: Set<string>;
|
|
7
|
-
export declare function
|
|
8
|
+
export declare function uniUTSUniModulesPlugin(options?: UniUTSPluginOptions): Plugin;
|
|
8
9
|
export {};
|
|
@@ -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.
|
|
6
|
+
exports.uniUTSUniModulesPlugin = exports.utsPlugins = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
9
9
|
const uts_1 = require("../../../uts");
|
|
@@ -14,10 +14,10 @@ function isUTSProxy(id) {
|
|
|
14
14
|
}
|
|
15
15
|
const utsModuleCaches = new Map();
|
|
16
16
|
exports.utsPlugins = new Set();
|
|
17
|
-
function
|
|
17
|
+
function uniUTSUniModulesPlugin(options = {}) {
|
|
18
18
|
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
19
19
|
return {
|
|
20
|
-
name: 'uni:uts',
|
|
20
|
+
name: 'uni:uts-uni_modules',
|
|
21
21
|
apply: 'build',
|
|
22
22
|
enforce: 'pre',
|
|
23
23
|
resolveId(id, importer) {
|
|
@@ -66,6 +66,7 @@ function uniUTSAppPlugin(options = {}) {
|
|
|
66
66
|
exports.utsPlugins.add(path_1.default.basename(pluginDir));
|
|
67
67
|
return (0, uts_1.resolveUTSCompiler)().compile(pluginDir, {
|
|
68
68
|
isX: !!options.x,
|
|
69
|
+
isSingleThread: !!options.isSingleThread,
|
|
69
70
|
isPlugin: true,
|
|
70
71
|
extApis: options.extApis,
|
|
71
72
|
sourceMap: process.env.NODE_ENV === 'development',
|
|
@@ -86,4 +87,4 @@ function uniUTSAppPlugin(options = {}) {
|
|
|
86
87
|
},
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
|
-
exports.
|
|
90
|
+
exports.uniUTSUniModulesPlugin = uniUTSUniModulesPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.uniUTSUVueJavaScriptPlugin = void 0;
|
|
4
4
|
const vue_1 = require("../../../vue");
|
|
5
|
-
function
|
|
5
|
+
function uniUTSUVueJavaScriptPlugin(options = {}) {
|
|
6
6
|
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
7
7
|
return {
|
|
8
|
-
name: 'uni:uts',
|
|
8
|
+
name: 'uni:uts-uvue',
|
|
9
9
|
enforce: 'pre',
|
|
10
10
|
configResolved(config) {
|
|
11
11
|
// 移除自带的 esbuild 处理 ts 文件
|
|
@@ -30,4 +30,4 @@ function uniUTSJsPlugin(options = {}) {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
exports.
|
|
33
|
+
exports.uniUTSUVueJavaScriptPlugin = uniUTSUVueJavaScriptPlugin;
|
|
@@ -30,7 +30,9 @@ export declare const isDirectCSSRequest: (request: string) => boolean;
|
|
|
30
30
|
/**
|
|
31
31
|
* Plugin applied before user plugins
|
|
32
32
|
*/
|
|
33
|
-
export declare function cssPlugin(config: ResolvedConfig
|
|
33
|
+
export declare function cssPlugin(config: ResolvedConfig, options?: {
|
|
34
|
+
isAppX: boolean;
|
|
35
|
+
}): Plugin;
|
|
34
36
|
/**
|
|
35
37
|
* Plugin applied after user plugins
|
|
36
38
|
*/
|
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.hoistAtRules = exports.minifyCSS = exports.importCssRE = exports.cssDataUriRE = exports.cssUrlRE = exports.formatPostcssSourceMap = exports.cssPostPlugin = exports.cssPlugin = exports.isDirectCSSRequest = exports.isCSSRequest = exports.commonjsProxyRE = exports.cssLangRE = void 0;
|
|
30
|
-
const
|
|
30
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
33
33
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
@@ -57,7 +57,7 @@ const postcssConfigCache = new WeakMap();
|
|
|
57
57
|
/**
|
|
58
58
|
* Plugin applied before user plugins
|
|
59
59
|
*/
|
|
60
|
-
function cssPlugin(config) {
|
|
60
|
+
function cssPlugin(config, options) {
|
|
61
61
|
let server;
|
|
62
62
|
let moduleCache;
|
|
63
63
|
const resolveUrl = config.createResolver({
|
|
@@ -87,7 +87,14 @@ function cssPlugin(config) {
|
|
|
87
87
|
}
|
|
88
88
|
const resolved = await resolveUrl(url, importer);
|
|
89
89
|
if (resolved) {
|
|
90
|
-
return (0, asset_1.fileToUrl)(resolved, config,
|
|
90
|
+
return (0, asset_1.fileToUrl)(resolved, config, options?.isAppX
|
|
91
|
+
? {
|
|
92
|
+
emitFile(emittedFile) {
|
|
93
|
+
// 直接写入目标目录
|
|
94
|
+
fs_extra_1.default.outputFileSync(path_1.default.resolve(process.env.UNI_OUTPUT_DIR, emittedFile.fileName), emittedFile.source);
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
: this, true);
|
|
91
98
|
}
|
|
92
99
|
return url;
|
|
93
100
|
};
|
|
@@ -843,7 +850,7 @@ function preprocessCss(content, isNVue = false) {
|
|
|
843
850
|
async function rebaseUrls(file, rootFile, alias, isNVue = false) {
|
|
844
851
|
file = path_1.default.resolve(file); // ensure os-specific flashes
|
|
845
852
|
// fixed by xxxxxx 条件编译
|
|
846
|
-
let contents = preprocessCss(
|
|
853
|
+
let contents = preprocessCss(fs_extra_1.default.readFileSync(file, 'utf-8'), isNVue);
|
|
847
854
|
// in the same dir, no need to rebase
|
|
848
855
|
const fileDir = path_1.default.dirname(file);
|
|
849
856
|
const rootDir = path_1.default.dirname(rootFile);
|
|
@@ -960,7 +967,7 @@ function createViteLessPlugin(less, rootFile, alias, resolvers, isNVue) {
|
|
|
960
967
|
contents = result.contents;
|
|
961
968
|
}
|
|
962
969
|
else {
|
|
963
|
-
contents =
|
|
970
|
+
contents = fs_extra_1.default.readFileSync(resolved, 'utf-8');
|
|
964
971
|
}
|
|
965
972
|
return {
|
|
966
973
|
filename: path_1.default.resolve(resolved),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-3090820231124001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/core": "^7.21.3",
|
|
26
26
|
"@babel/parser": "^7.16.4",
|
|
27
27
|
"@babel/types": "^7.20.7",
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-3090820231124001",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-3090820231124001",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@dcloudio/uni-uts-v1": "3.0.0-
|
|
67
|
+
"@dcloudio/uni-uts-v1": "3.0.0-3090820231124001",
|
|
68
68
|
"@types/babel__core": "^7.1.19",
|
|
69
69
|
"@types/debug": "^4.1.7",
|
|
70
70
|
"@types/estree": "^0.0.51",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"@types/sass": "^1.43.1",
|
|
78
78
|
"@types/stylus": "^0.48.36",
|
|
79
79
|
"postcss": "^8.4.21",
|
|
80
|
+
"unplugin-auto-import": "^0.16.7",
|
|
80
81
|
"vue": "3.2.47"
|
|
81
82
|
}
|
|
82
83
|
}
|