@dcloudio/uni-cli-shared 3.0.0-alpha-3021320211109002 → 3.0.0-alpha-3021220211105012
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 +2 -0
- package/dist/constants.js +3 -1
- package/dist/easycom.d.ts +7 -1
- package/dist/easycom.js +25 -6
- package/dist/env/define.d.ts +2 -0
- package/dist/env/define.js +5 -0
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +8 -0
- package/dist/filter.d.ts +16 -0
- package/dist/filter.js +60 -0
- package/dist/hbx/index.js +0 -7
- package/dist/hbx/log.d.ts +2 -0
- package/dist/hbx/log.js +36 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/json/app/manifest/nvue.d.ts +3 -3
- package/dist/json/app/pages/index.d.ts +0 -1
- package/dist/json/app/pages/index.js +0 -11
- package/dist/json/manifest.d.ts +1 -1
- package/dist/json/manifest.js +9 -3
- package/dist/json/mp/index.d.ts +1 -0
- package/dist/json/mp/index.js +11 -0
- package/dist/json/mp/jsonFile.d.ts +7 -6
- package/dist/json/mp/jsonFile.js +56 -13
- package/dist/json/mp/pages.d.ts +1 -0
- package/dist/json/mp/pages.js +17 -3
- package/dist/json/mp/types.d.ts +1 -0
- package/dist/json/pages.js +0 -4
- package/dist/logs/console.js +5 -2
- package/dist/logs/format.js +6 -0
- package/dist/messages/index.d.ts +2 -0
- package/dist/messages/index.js +2 -0
- package/dist/mp/constants.d.ts +2 -0
- package/dist/mp/constants.js +5 -0
- package/dist/mp/event.d.ts +2 -1
- package/dist/mp/event.js +18 -3
- package/dist/mp/imports.d.ts +5 -0
- package/dist/mp/imports.js +63 -0
- package/dist/mp/index.d.ts +5 -0
- package/dist/mp/index.js +7 -0
- package/dist/mp/nvue.d.ts +1 -0
- package/dist/mp/nvue.js +18 -0
- package/dist/mp/style.d.ts +1 -0
- package/dist/mp/style.js +10 -0
- package/dist/mp/template.d.ts +55 -0
- package/dist/mp/template.js +73 -0
- package/dist/mp/transformImports.d.ts +14 -0
- package/dist/mp/transformImports.js +175 -0
- package/dist/postcss/plugins/stylePluginScoped.d.ts +1 -1
- package/dist/postcss/plugins/uniapp.d.ts +1 -1
- package/dist/postcss/plugins/uniapp.js +51 -21
- package/dist/preprocess/context.js +1 -0
- package/dist/utils.d.ts +8 -1
- package/dist/utils.js +71 -8
- package/dist/vite/features.d.ts +1 -1
- package/dist/vite/index.d.ts +2 -3
- package/dist/vite/plugins/copy.d.ts +1 -1
- package/dist/vite/plugins/cssScoped.d.ts +1 -1
- package/dist/vite/plugins/inject.d.ts +1 -1
- package/dist/vite/plugins/inject.js +2 -2
- package/dist/vite/plugins/vitejs/config.d.ts +1 -1
- package/dist/vite/plugins/vitejs/index.d.ts +1 -1
- package/dist/vite/plugins/vitejs/plugin.d.ts +1 -1
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +1 -1
- package/dist/vite/plugins/vitejs/plugins/asset.js +28 -21
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +4 -4
- package/dist/vite/plugins/vitejs/plugins/css.js +15 -24
- package/dist/vite/plugins/vitejs/server/moduleGraph.d.ts +1 -1
- package/dist/vite/plugins/vitejs/server/moduleGraph.js +0 -3
- package/dist/vite/utils/ast.d.ts +1 -1
- package/dist/vite/utils/index.d.ts +1 -1
- package/dist/vite/utils/plugin.d.ts +4 -4
- package/dist/vite/utils/plugin.js +2 -2
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +14 -0
- package/dist/vue/transforms/index.d.ts +10 -0
- package/dist/vue/transforms/index.js +36 -0
- package/dist/vue/transforms/transformComponent.d.ts +3 -0
- package/dist/vue/transforms/transformComponent.js +26 -0
- package/dist/vue/transforms/transformEvent.d.ts +2 -0
- package/dist/vue/transforms/transformEvent.js +22 -0
- package/dist/vue/transforms/transformPageHead.d.ts +2 -0
- package/dist/vue/transforms/transformPageHead.js +11 -0
- package/dist/vue/transforms/transformRef.d.ts +2 -0
- package/dist/vue/transforms/transformRef.js +32 -0
- package/dist/vue/transforms/transformTag.d.ts +3 -0
- package/dist/vue/transforms/transformTag.js +45 -0
- package/dist/vue/transforms/vModel.d.ts +12 -0
- package/dist/vue/transforms/vModel.js +33 -0
- package/dist/vue/transforms/vOn.d.ts +15 -0
- package/dist/vue/transforms/vOn.js +88 -0
- package/dist/vue/utils.d.ts +9 -0
- package/dist/vue/utils.js +66 -0
- package/lib/nvue.css +34 -0
- package/package.json +20 -6
- package/LICENSE +0 -202
- package/dist/json/app/pages/nvue.d.ts +0 -1
- package/dist/json/app/pages/nvue.js +0 -88
- package/dist/renderjs.d.ts +0 -16
- package/dist/renderjs.js +0 -44
package/dist/constants.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare const EXTNAME_JS: string[];
|
|
|
3
3
|
export declare const EXTNAME_VUE: string[];
|
|
4
4
|
export declare const EXTNAME_VUE_RE: RegExp;
|
|
5
5
|
export declare const EXTNAME_JS_RE: RegExp;
|
|
6
|
+
export declare const ASSETS_INLINE_LIMIT: number;
|
|
7
|
+
export declare const BINDING_COMPONENTS = "__BINDING_COMPONENTS__";
|
|
6
8
|
export declare const PAGE_EXTNAME_APP: string[];
|
|
7
9
|
export declare const PAGE_EXTNAME: string[];
|
|
8
10
|
export declare const H5_API_STYLE_PATH = "@dcloudio/uni-h5/style/api/";
|
package/dist/constants.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
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.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE = 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.ASSETS_INLINE_LIMIT = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE = 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_VUE = ['.vue', '.nvue'];
|
|
7
7
|
exports.EXTNAME_VUE_RE = /\.(vue|nvue)$/;
|
|
8
8
|
exports.EXTNAME_JS_RE = /\.[jt]sx?$/;
|
|
9
|
+
exports.ASSETS_INLINE_LIMIT = 40 * 1024;
|
|
10
|
+
exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
|
|
9
11
|
// APP 平台解析页面后缀的优先级
|
|
10
12
|
exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js'];
|
|
11
13
|
// 其他平台解析页面后缀的优先级
|
package/dist/easycom.d.ts
CHANGED
|
@@ -12,7 +12,10 @@ interface EasycomMatcher {
|
|
|
12
12
|
interface EasycomCustom {
|
|
13
13
|
[key: string]: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function initEasycoms(inputDir: string, platform
|
|
15
|
+
export declare function initEasycoms(inputDir: string, { dirs, platform }: {
|
|
16
|
+
dirs: string[];
|
|
17
|
+
platform: UniApp.PLATFORM;
|
|
18
|
+
}): {
|
|
16
19
|
options: EasycomOption;
|
|
17
20
|
filter: (id: unknown) => boolean;
|
|
18
21
|
refresh(): void;
|
|
@@ -20,4 +23,7 @@ export declare function initEasycoms(inputDir: string, platform: UniApp.PLATFORM
|
|
|
20
23
|
};
|
|
21
24
|
export declare const initEasycomsOnce: typeof initEasycoms;
|
|
22
25
|
export declare function matchEasycom(tag: string): string | false | undefined;
|
|
26
|
+
export declare function addImportDeclaration(importDeclarations: string[], local: string, source: string, imported?: string): string;
|
|
27
|
+
export declare function genResolveEasycomCode(importDeclarations: string[], code: string, name: string): string;
|
|
28
|
+
export declare const UNI_EASYCOM_EXCLUDE: RegExp[];
|
|
23
29
|
export {};
|
package/dist/easycom.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.matchEasycom = exports.initEasycomsOnce = exports.initEasycoms = void 0;
|
|
6
|
+
exports.UNI_EASYCOM_EXCLUDE = exports.genResolveEasycomCode = exports.addImportDeclaration = exports.matchEasycom = exports.initEasycomsOnce = exports.initEasycoms = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const debug_1 = __importDefault(require("debug"));
|
|
@@ -13,7 +13,7 @@ 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 debugEasycom = (0, debug_1.default)('uni:easycom');
|
|
16
|
+
const debugEasycom = (0, debug_1.default)('vite:uni:easycom');
|
|
17
17
|
const easycoms = [];
|
|
18
18
|
const easycomsCache = new Map();
|
|
19
19
|
const easycomsInvalidCache = new Set();
|
|
@@ -23,8 +23,7 @@ function clearEasycom() {
|
|
|
23
23
|
easycomsCache.clear();
|
|
24
24
|
easycomsInvalidCache.clear();
|
|
25
25
|
}
|
|
26
|
-
function initEasycoms(inputDir, platform) {
|
|
27
|
-
const buildInComponentsDir = path_1.default.resolve(require.resolve('@dcloudio/uni-components'), '../lib');
|
|
26
|
+
function initEasycoms(inputDir, { dirs, platform }) {
|
|
28
27
|
const componentsDir = path_1.default.resolve(inputDir, 'components');
|
|
29
28
|
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
30
29
|
const initEasycomOptions = (pagesJson) => {
|
|
@@ -32,9 +31,9 @@ function initEasycoms(inputDir, platform) {
|
|
|
32
31
|
const { easycom } = pagesJson || (0, pages_1.parsePagesJson)(inputDir, platform, false);
|
|
33
32
|
const easycomOptions = {
|
|
34
33
|
dirs: easycom && easycom.autoscan === false
|
|
35
|
-
? [
|
|
34
|
+
? [...dirs] // 禁止自动扫描
|
|
36
35
|
: [
|
|
37
|
-
|
|
36
|
+
...dirs,
|
|
38
37
|
componentsDir,
|
|
39
38
|
...initUniModulesEasycomDirs(uniModulesDir),
|
|
40
39
|
],
|
|
@@ -178,3 +177,23 @@ function initAutoScanEasycoms(dirs, rootDir, extensions) {
|
|
|
178
177
|
function normalizeCompath(compath, rootDir) {
|
|
179
178
|
return (0, utils_1.normalizePath)(path_1.default.relative(rootDir, compath));
|
|
180
179
|
}
|
|
180
|
+
function addImportDeclaration(importDeclarations, local, source, imported) {
|
|
181
|
+
importDeclarations.push(createImportDeclaration(local, source, imported));
|
|
182
|
+
return local;
|
|
183
|
+
}
|
|
184
|
+
exports.addImportDeclaration = addImportDeclaration;
|
|
185
|
+
function createImportDeclaration(local, source, imported) {
|
|
186
|
+
if (imported) {
|
|
187
|
+
return `import {${imported} as ${local}} from '${source}';`;
|
|
188
|
+
}
|
|
189
|
+
return `import ${local} from '${source}';`;
|
|
190
|
+
}
|
|
191
|
+
const RESOLVE_EASYCOM_IMPORT_CODE = `import { resolveDynamicComponent as __resolveDynamicComponent } from 'vue';import { resolveEasycom } from '@dcloudio/uni-app';`;
|
|
192
|
+
function genResolveEasycomCode(importDeclarations, code, name) {
|
|
193
|
+
if (!importDeclarations.includes(RESOLVE_EASYCOM_IMPORT_CODE)) {
|
|
194
|
+
importDeclarations.push(RESOLVE_EASYCOM_IMPORT_CODE);
|
|
195
|
+
}
|
|
196
|
+
return `resolveEasycom(${code.replace('_resolveComponent', '__resolveDynamicComponent')}, ${name})`;
|
|
197
|
+
}
|
|
198
|
+
exports.genResolveEasycomCode = genResolveEasycomCode;
|
|
199
|
+
exports.UNI_EASYCOM_EXCLUDE = [/App.vue$/, /@dcloudio\/uni-h5/];
|
package/dist/env/define.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare function initDefine(stringifyBoolean?: boolean): {
|
|
2
2
|
'process.env.NODE_ENV': string;
|
|
3
|
+
'process.env.UNI_DEBUG': string | boolean;
|
|
3
4
|
'process.env.UNI_APP_ID': string;
|
|
4
5
|
'process.env.UNI_APP_NAME': string;
|
|
5
6
|
'process.env.UNI_PLATFORM': string;
|
|
7
|
+
'process.env.UNI_COMPILER_VERSION': string;
|
|
6
8
|
'process.env.RUN_BY_HBUILDERX': string | boolean;
|
|
7
9
|
'process.env.UNI_AUTOMATOR_WS_ENDPOINT': string;
|
|
8
10
|
'process.env.UNI_CLOUD_PROVIDER': string;
|
package/dist/env/define.js
CHANGED
|
@@ -6,11 +6,16 @@ const json_1 = require("../json");
|
|
|
6
6
|
function initDefine(stringifyBoolean = false) {
|
|
7
7
|
const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
|
|
8
8
|
const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
|
|
9
|
+
const isDebug = !!manifestJson.debug;
|
|
9
10
|
return {
|
|
10
11
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
12
|
+
'process.env.UNI_DEBUG': stringifyBoolean
|
|
13
|
+
? JSON.stringify(isDebug)
|
|
14
|
+
: isDebug,
|
|
11
15
|
'process.env.UNI_APP_ID': JSON.stringify(manifestJson.appid || ''),
|
|
12
16
|
'process.env.UNI_APP_NAME': JSON.stringify(manifestJson.name || ''),
|
|
13
17
|
'process.env.UNI_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM),
|
|
18
|
+
'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION),
|
|
14
19
|
'process.env.RUN_BY_HBUILDERX': stringifyBoolean
|
|
15
20
|
? JSON.stringify(isRunByHBuilderX)
|
|
16
21
|
: isRunByHBuilderX,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as chokidar } from 'chokidar';
|
package/dist/exports.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.chokidar = void 0;
|
|
7
|
+
var chokidar_1 = require("chokidar");
|
|
8
|
+
Object.defineProperty(exports, "chokidar", { enumerable: true, get: function () { return __importDefault(chokidar_1).default; } });
|
package/dist/filter.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function isWxs(id: string): boolean;
|
|
2
|
+
export declare function isSjs(id: string): boolean;
|
|
3
|
+
export declare function isRenderjs(id: string): boolean;
|
|
4
|
+
declare type FilterType = 'wxs' | 'renderjs' | 'sjs';
|
|
5
|
+
export declare function parseRenderjs(id: string): {
|
|
6
|
+
type: FilterType;
|
|
7
|
+
name: string;
|
|
8
|
+
filename: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: "";
|
|
11
|
+
readonly name: "";
|
|
12
|
+
readonly filename: "";
|
|
13
|
+
};
|
|
14
|
+
export declare function missingModuleName(type: FilterType, code: string): string;
|
|
15
|
+
export declare function parseFilterNames(lang: string, code: string): string[];
|
|
16
|
+
export {};
|
package/dist/filter.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFilterNames = exports.missingModuleName = exports.parseRenderjs = exports.isRenderjs = exports.isSjs = exports.isWxs = void 0;
|
|
4
|
+
const url_1 = require("./vite/utils/url");
|
|
5
|
+
const WXS_RE = /vue&type=wxs/;
|
|
6
|
+
function isWxs(id) {
|
|
7
|
+
return WXS_RE.test(id);
|
|
8
|
+
}
|
|
9
|
+
exports.isWxs = isWxs;
|
|
10
|
+
const SJS_RE = /vue&type=sjs/;
|
|
11
|
+
function isSjs(id) {
|
|
12
|
+
return SJS_RE.test(id);
|
|
13
|
+
}
|
|
14
|
+
exports.isSjs = isSjs;
|
|
15
|
+
const RENDERJS_RE = /vue&type=renderjs/;
|
|
16
|
+
function isRenderjs(id) {
|
|
17
|
+
return RENDERJS_RE.test(id);
|
|
18
|
+
}
|
|
19
|
+
exports.isRenderjs = isRenderjs;
|
|
20
|
+
function parseRenderjs(id) {
|
|
21
|
+
if (isWxs(id) || isRenderjs(id) || isSjs(id)) {
|
|
22
|
+
const { query, filename } = (0, url_1.parseVueRequest)(id);
|
|
23
|
+
return {
|
|
24
|
+
type: query.type,
|
|
25
|
+
name: query.name,
|
|
26
|
+
filename,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
type: '',
|
|
31
|
+
name: '',
|
|
32
|
+
filename: '',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.parseRenderjs = parseRenderjs;
|
|
36
|
+
function missingModuleName(type, code) {
|
|
37
|
+
return `<script module="missing module name" lang="${type}">
|
|
38
|
+
${code}
|
|
39
|
+
</script>`;
|
|
40
|
+
}
|
|
41
|
+
exports.missingModuleName = missingModuleName;
|
|
42
|
+
const moduleRE = /module=["'](.*?)["']/;
|
|
43
|
+
function parseFilterNames(lang, code) {
|
|
44
|
+
const names = [];
|
|
45
|
+
const scriptTags = code.match(/<script\b[^>]*>/gm);
|
|
46
|
+
if (!scriptTags) {
|
|
47
|
+
return names;
|
|
48
|
+
}
|
|
49
|
+
const langRE = new RegExp(`lang=["']${lang}["']`);
|
|
50
|
+
scriptTags.forEach((scriptTag) => {
|
|
51
|
+
if (langRE.test(scriptTag)) {
|
|
52
|
+
const matches = scriptTag.match(moduleRE);
|
|
53
|
+
if (matches) {
|
|
54
|
+
names.push(matches[1]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return names;
|
|
59
|
+
}
|
|
60
|
+
exports.parseFilterNames = parseFilterNames;
|
package/dist/hbx/index.js
CHANGED
|
@@ -9,15 +9,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
13
|
exports.initModuleAlias = void 0;
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
process.env.UNI_HBUILDERX_PLUGINS =
|
|
19
|
-
process.env.UNI_HBUILDERX_PLUGINS ||
|
|
20
|
-
path_1.default.resolve(__dirname, '../../../../../../');
|
|
21
14
|
__exportStar(require("./env"), exports);
|
|
22
15
|
var alias_1 = require("./alias");
|
|
23
16
|
Object.defineProperty(exports, "initModuleAlias", { enumerable: true, get: function () { return alias_1.initModuleAlias; } });
|
package/dist/hbx/log.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ import { Formatter } from '../logs/format';
|
|
|
2
2
|
export declare const h5ServeFormatter: Formatter;
|
|
3
3
|
export declare const removeInfoFormatter: Formatter;
|
|
4
4
|
export declare const removeWarnFormatter: Formatter;
|
|
5
|
+
export declare const FilenameFormatter: Formatter;
|
|
6
|
+
export declare const HBuilderXFileFormatter: Formatter;
|
package/dist/hbx/log.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = void 0;
|
|
6
|
+
exports.HBuilderXFileFormatter = exports.FilenameFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const utils_1 = require("../utils");
|
|
4
9
|
const SIGNAL_H5_LOCAL = ' > Local:';
|
|
5
10
|
const SIGNAL_H5_NETWORK = ' > Network:';
|
|
6
11
|
const networkLogs = [];
|
|
@@ -40,7 +45,7 @@ exports.removeInfoFormatter = {
|
|
|
40
45
|
return '';
|
|
41
46
|
},
|
|
42
47
|
};
|
|
43
|
-
const REMOVED_WARN_MSGS = [
|
|
48
|
+
const REMOVED_WARN_MSGS = [];
|
|
44
49
|
exports.removeWarnFormatter = {
|
|
45
50
|
test(msg) {
|
|
46
51
|
return !!REMOVED_WARN_MSGS.find((m) => msg.includes(m));
|
|
@@ -49,3 +54,32 @@ exports.removeWarnFormatter = {
|
|
|
49
54
|
return '';
|
|
50
55
|
},
|
|
51
56
|
};
|
|
57
|
+
const fileRE = /file:\s(.*):(\d+):(\d+)/;
|
|
58
|
+
exports.FilenameFormatter = {
|
|
59
|
+
test(msg) {
|
|
60
|
+
return fileRE.test(msg);
|
|
61
|
+
},
|
|
62
|
+
format(msg) {
|
|
63
|
+
return msg.replace(fileRE, (_, filename, line, column) => {
|
|
64
|
+
return `file: ${filename.split('?')[0]}:${line}:${column}`;
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
exports.HBuilderXFileFormatter = {
|
|
69
|
+
test(msg) {
|
|
70
|
+
return fileRE.test(msg);
|
|
71
|
+
},
|
|
72
|
+
format(msg) {
|
|
73
|
+
return (msg
|
|
74
|
+
// remove color
|
|
75
|
+
.replace(/\x1B[[(?);]{0,2}(;?\d)*./g, '')
|
|
76
|
+
.replace(fileRE, (_, filename, line, column) => {
|
|
77
|
+
return ('at ' +
|
|
78
|
+
(0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename.split('?')[0])) +
|
|
79
|
+
':' +
|
|
80
|
+
line +
|
|
81
|
+
':' +
|
|
82
|
+
column);
|
|
83
|
+
}));
|
|
84
|
+
},
|
|
85
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export * from './fs';
|
|
|
2
2
|
export * from './mp';
|
|
3
3
|
export * from './env';
|
|
4
4
|
export * from './hbx';
|
|
5
|
-
export * from './logs';
|
|
6
5
|
export * from './ssr';
|
|
6
|
+
export * from './vue';
|
|
7
|
+
export * from './logs';
|
|
7
8
|
export * from './i18n';
|
|
8
9
|
export * from './deps';
|
|
9
10
|
export * from './json';
|
|
@@ -13,7 +14,8 @@ export * from './easycom';
|
|
|
13
14
|
export * from './constants';
|
|
14
15
|
export * from './preprocess';
|
|
15
16
|
export * from './postcss';
|
|
16
|
-
export * from './
|
|
17
|
+
export * from './filter';
|
|
17
18
|
export * from './esbuild';
|
|
18
19
|
export { M } from './messages';
|
|
20
|
+
export * from './exports';
|
|
19
21
|
export { checkUpdate } from './checkUpdate';
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,9 @@ __exportStar(require("./fs"), exports);
|
|
|
15
15
|
__exportStar(require("./mp"), exports);
|
|
16
16
|
__exportStar(require("./env"), exports);
|
|
17
17
|
__exportStar(require("./hbx"), exports);
|
|
18
|
-
__exportStar(require("./logs"), exports);
|
|
19
18
|
__exportStar(require("./ssr"), exports);
|
|
19
|
+
__exportStar(require("./vue"), exports);
|
|
20
|
+
__exportStar(require("./logs"), exports);
|
|
20
21
|
__exportStar(require("./i18n"), exports);
|
|
21
22
|
__exportStar(require("./deps"), exports);
|
|
22
23
|
__exportStar(require("./json"), exports);
|
|
@@ -26,9 +27,10 @@ __exportStar(require("./easycom"), exports);
|
|
|
26
27
|
__exportStar(require("./constants"), exports);
|
|
27
28
|
__exportStar(require("./preprocess"), exports);
|
|
28
29
|
__exportStar(require("./postcss"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
30
|
+
__exportStar(require("./filter"), exports);
|
|
30
31
|
__exportStar(require("./esbuild"), exports);
|
|
31
32
|
var messages_1 = require("./messages");
|
|
32
33
|
Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } });
|
|
34
|
+
__exportStar(require("./exports"), exports);
|
|
33
35
|
var checkUpdate_1 = require("./checkUpdate");
|
|
34
36
|
Object.defineProperty(exports, "checkUpdate", { enumerable: true, get: function () { return checkUpdate_1.checkUpdate; } });
|
|
@@ -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>): "
|
|
3
|
-
export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "
|
|
4
|
-
export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "
|
|
2
|
+
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "weex" | "vue";
|
|
3
|
+
export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "uni-app" | "weex";
|
|
4
|
+
export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "row" | "row-reverse" | "column" | "column-reverse";
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.normalizeAppConfigService = exports.normalizeAppPagesJson = void 0;
|
|
14
4
|
const code_1 = require("./code");
|
|
15
5
|
const definePage_1 = require("./definePage");
|
|
16
6
|
const uniConfig_1 = require("./uniConfig");
|
|
17
7
|
const uniRoutes_1 = require("./uniRoutes");
|
|
18
|
-
__exportStar(require("./nvue"), exports);
|
|
19
8
|
function normalizeAppPagesJson(pagesJson) {
|
|
20
9
|
return code_1.polyfillCode + code_1.restoreGlobalCode + (0, definePage_1.definePageCode)(pagesJson);
|
|
21
10
|
}
|
package/dist/json/manifest.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const parseManifestJson: (inputDir: string) => any;
|
|
2
2
|
export declare const parseManifestJsonOnce: (inputDir: string) => any;
|
|
3
|
-
export declare const parseRpx2UnitOnce: (inputDir: string) => any;
|
|
3
|
+
export declare const parseRpx2UnitOnce: (inputDir: string, platform?: UniApp.PLATFORM) => any;
|
|
4
4
|
interface CompilerCompatConfig {
|
|
5
5
|
MODE?: 2 | 3;
|
|
6
6
|
}
|
package/dist/json/manifest.js
CHANGED
|
@@ -14,9 +14,15 @@ const parseManifestJson = (inputDir) => {
|
|
|
14
14
|
};
|
|
15
15
|
exports.parseManifestJson = parseManifestJson;
|
|
16
16
|
exports.parseManifestJsonOnce = (0, uni_shared_1.once)(exports.parseManifestJson);
|
|
17
|
-
exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir, platform = 'h5') => {
|
|
18
|
+
const rpx2unit = platform === 'h5' || platform === 'app'
|
|
19
|
+
? uni_shared_1.defaultRpx2Unit
|
|
20
|
+
: uni_shared_1.defaultMiniProgramRpx2Unit;
|
|
21
|
+
const platformOptions = (0, exports.parseManifestJsonOnce)(inputDir)[platform];
|
|
22
|
+
if (platformOptions && platformOptions.rpx) {
|
|
23
|
+
return (0, shared_1.extend)({}, rpx2unit, platformOptions);
|
|
24
|
+
}
|
|
25
|
+
return (0, shared_1.extend)({}, rpx2unit);
|
|
20
26
|
});
|
|
21
27
|
function parseCompatConfig(_inputDir) {
|
|
22
28
|
// 不支持 mode:2
|
package/dist/json/mp/index.d.ts
CHANGED
package/dist/json/mp/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
13
|
exports.parseMiniProgramProjectJson = exports.parseMiniProgramPagesJson = void 0;
|
|
14
|
+
__exportStar(require("./jsonFile"), exports);
|
|
4
15
|
var pages_1 = require("./pages");
|
|
5
16
|
Object.defineProperty(exports, "parseMiniProgramPagesJson", { enumerable: true, get: function () { return pages_1.parseMiniProgramPagesJson; } });
|
|
6
17
|
var project_1 = require("./project");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ComponentJson, PageWindowOptions, UsingComponents } from './types';
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
2
|
+
export declare function hasJsonFile(filename: string): boolean;
|
|
3
|
+
export declare function normalizeJsonFilename(filename: string): string;
|
|
4
|
+
export declare function findChangedJsonFiles(): Map<string, string>;
|
|
5
|
+
export declare function addMiniProgramAppJson(appJson: Record<string, any>): void;
|
|
6
|
+
export declare function addMiniProgramPageJson(filename: string, json: PageWindowOptions): void;
|
|
7
|
+
export declare function addMiniProgramComponentJson(filename: string, json: ComponentJson): void;
|
|
8
|
+
export declare function addMiniProgramUsingComponents(filename: string, json: UsingComponents): void;
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -1,18 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = void 0;
|
|
4
|
+
const shared_1 = require("@vue/shared");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
let appJsonCache = {};
|
|
7
|
+
const jsonFilesCache = new Map();
|
|
8
|
+
const jsonPagesCache = new Map();
|
|
9
|
+
const jsonComponentsCache = new Map();
|
|
10
|
+
const jsonUsingComponentsCache = new Map();
|
|
11
|
+
function hasJsonFile(filename) {
|
|
12
|
+
return (filename === 'app' ||
|
|
13
|
+
jsonPagesCache.has(filename) ||
|
|
14
|
+
jsonComponentsCache.has(filename));
|
|
9
15
|
}
|
|
10
|
-
exports.
|
|
11
|
-
function
|
|
12
|
-
|
|
16
|
+
exports.hasJsonFile = hasJsonFile;
|
|
17
|
+
function normalizeJsonFilename(filename) {
|
|
18
|
+
return (0, utils_1.normalizeNodeModules)(filename);
|
|
13
19
|
}
|
|
14
|
-
exports.
|
|
15
|
-
function
|
|
16
|
-
|
|
20
|
+
exports.normalizeJsonFilename = normalizeJsonFilename;
|
|
21
|
+
function findChangedJsonFiles() {
|
|
22
|
+
const changedJsonFiles = new Map();
|
|
23
|
+
function findChangedFile(name, json) {
|
|
24
|
+
const newJson = (0, shared_1.extend)({}, json);
|
|
25
|
+
if (!newJson.usingComponents) {
|
|
26
|
+
newJson.usingComponents = {};
|
|
27
|
+
}
|
|
28
|
+
(0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(name));
|
|
29
|
+
const jsonStr = JSON.stringify(newJson, null, 2);
|
|
30
|
+
if (jsonFilesCache.get(name) !== jsonStr) {
|
|
31
|
+
changedJsonFiles.set(name, jsonStr);
|
|
32
|
+
jsonFilesCache.set(name, jsonStr);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function findChangedFiles(jsonsCache) {
|
|
36
|
+
for (const name of jsonsCache.keys()) {
|
|
37
|
+
findChangedFile(name, jsonsCache.get(name));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
findChangedFile('app', appJsonCache);
|
|
41
|
+
findChangedFiles(jsonPagesCache);
|
|
42
|
+
findChangedFiles(jsonComponentsCache);
|
|
43
|
+
return changedJsonFiles;
|
|
17
44
|
}
|
|
18
|
-
exports.
|
|
45
|
+
exports.findChangedJsonFiles = findChangedJsonFiles;
|
|
46
|
+
function addMiniProgramAppJson(appJson) {
|
|
47
|
+
appJsonCache = appJson;
|
|
48
|
+
}
|
|
49
|
+
exports.addMiniProgramAppJson = addMiniProgramAppJson;
|
|
50
|
+
function addMiniProgramPageJson(filename, json) {
|
|
51
|
+
jsonPagesCache.set(filename, json);
|
|
52
|
+
}
|
|
53
|
+
exports.addMiniProgramPageJson = addMiniProgramPageJson;
|
|
54
|
+
function addMiniProgramComponentJson(filename, json) {
|
|
55
|
+
jsonComponentsCache.set(filename, json);
|
|
56
|
+
}
|
|
57
|
+
exports.addMiniProgramComponentJson = addMiniProgramComponentJson;
|
|
58
|
+
function addMiniProgramUsingComponents(filename, json) {
|
|
59
|
+
jsonUsingComponentsCache.set(filename, json);
|
|
60
|
+
}
|
|
61
|
+
exports.addMiniProgramUsingComponents = addMiniProgramUsingComponents;
|
package/dist/json/mp/pages.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ interface ParsePagesJsonOptions {
|
|
|
11
11
|
export declare function parseMiniProgramPagesJson(jsonStr: string, platform: UniApp.PLATFORM, options?: ParsePagesJsonOptions): {
|
|
12
12
|
appJson: AppJson;
|
|
13
13
|
pageJsons: Record<string, PageWindowOptions>;
|
|
14
|
+
nvuePages: string[];
|
|
14
15
|
};
|
|
15
16
|
export {};
|
package/dist/json/mp/pages.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.parseMiniProgramPagesJson = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const shared_1 = require("@vue/shared");
|
|
9
10
|
const json_1 = require("../json");
|
|
@@ -14,20 +15,32 @@ function parseMiniProgramPagesJson(jsonStr, platform, options = { subpackages: f
|
|
|
14
15
|
return parsePagesJson(jsonStr, platform, options);
|
|
15
16
|
}
|
|
16
17
|
exports.parseMiniProgramPagesJson = parseMiniProgramPagesJson;
|
|
17
|
-
function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, subpackages, windowOptionsMap, } = {
|
|
18
|
+
function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, subpackages, windowOptionsMap, tabBarOptionsMap, tabBarItemOptionsMap, } = {
|
|
18
19
|
subpackages: false,
|
|
19
20
|
}) {
|
|
20
21
|
const appJson = {
|
|
21
22
|
pages: [],
|
|
22
23
|
};
|
|
23
24
|
const pageJsons = {};
|
|
25
|
+
const nvuePages = [];
|
|
24
26
|
// preprocess
|
|
25
27
|
const pagesJson = (0, json_1.parseJson)(jsonStr, true);
|
|
26
28
|
if (!pagesJson) {
|
|
27
29
|
throw new Error(`[vite] Error: pages.json parse failed.\n`);
|
|
28
30
|
}
|
|
29
31
|
function addPageJson(pagePath, style) {
|
|
30
|
-
|
|
32
|
+
const filename = path_1.default.join(process.env.UNI_INPUT_DIR, pagePath);
|
|
33
|
+
if (fs_1.default.existsSync(filename + '.nvue') &&
|
|
34
|
+
!fs_1.default.existsSync(filename + '.vue')) {
|
|
35
|
+
nvuePages.push(pagePath);
|
|
36
|
+
}
|
|
37
|
+
const windowOptions = {};
|
|
38
|
+
if (platform === 'mp-baidu') {
|
|
39
|
+
// 仅百度小程序需要页面配置 component:true
|
|
40
|
+
// 快手小程序反而不能配置 component:true,故不能统一添加,目前硬编码处理
|
|
41
|
+
windowOptions.component = true;
|
|
42
|
+
}
|
|
43
|
+
pageJsons[pagePath] = (0, shared_1.extend)(windowOptions, (0, utils_1.parseWindowOptions)(style, platform, windowOptionsMap));
|
|
31
44
|
}
|
|
32
45
|
// pages
|
|
33
46
|
(0, pages_1.validatePages)(pagesJson, jsonStr);
|
|
@@ -65,7 +78,7 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
|
|
|
65
78
|
}
|
|
66
79
|
// tabBar
|
|
67
80
|
if (pagesJson.tabBar) {
|
|
68
|
-
const tabBar = (0, utils_1.parseTabBar)(pagesJson.tabBar, platform);
|
|
81
|
+
const tabBar = (0, utils_1.parseTabBar)(pagesJson.tabBar, platform, tabBarOptionsMap, tabBarItemOptionsMap);
|
|
69
82
|
if (tabBar) {
|
|
70
83
|
appJson.tabBar = tabBar;
|
|
71
84
|
}
|
|
@@ -89,5 +102,6 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
|
|
|
89
102
|
return {
|
|
90
103
|
appJson,
|
|
91
104
|
pageJsons,
|
|
105
|
+
nvuePages,
|
|
92
106
|
};
|
|
93
107
|
}
|
package/dist/json/mp/types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface ShareWindowOptions {
|
|
|
18
18
|
declare type Style = 'v2' | string;
|
|
19
19
|
declare type RestartStrategy = 'homePage' | 'homePageAndLatestPage' | string;
|
|
20
20
|
export interface PageWindowOptions extends ShareWindowOptions {
|
|
21
|
+
component?: true;
|
|
21
22
|
disableScroll?: boolean;
|
|
22
23
|
usingComponents?: UsingComponents;
|
|
23
24
|
initialRenderingCache?: 'static' | string;
|
package/dist/json/pages.js
CHANGED
|
@@ -10,7 +10,6 @@ const shared_1 = require("@vue/shared");
|
|
|
10
10
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
const json_1 = require("./json");
|
|
13
|
-
const pages_1 = require("./app/pages");
|
|
14
13
|
const parsePagesJson = (inputDir, platform, normalize = true) => {
|
|
15
14
|
const jsonStr = fs_1.default.readFileSync(path_1.default.join(inputDir, 'pages.json'), 'utf8');
|
|
16
15
|
if (normalize) {
|
|
@@ -55,9 +54,6 @@ function normalizePagesJson(jsonStr, platform, { subpackages, } = { subpackages:
|
|
|
55
54
|
}
|
|
56
55
|
// pageStyle
|
|
57
56
|
normalizePages(pagesJson.pages, platform);
|
|
58
|
-
if (platform === 'app' && process.env.UNI_NVUE_COMPILER !== 'vue') {
|
|
59
|
-
(0, pages_1.initWebpackNVueEntry)(pagesJson.pages);
|
|
60
|
-
}
|
|
61
57
|
// globalStyle
|
|
62
58
|
pagesJson.globalStyle = normalizePageStyle(null, pagesJson.globalStyle, platform);
|
|
63
59
|
// tabBar
|