@dcloudio/uni-cli-shared 3.0.0-alpha-3060420220922006 → 3.0.0-alpha-3060420220922008
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.
|
@@ -17,7 +17,7 @@ export declare function isMiniProgramUsingComponent(name: string, options: {
|
|
|
17
17
|
componentsDir?: string;
|
|
18
18
|
}): boolean;
|
|
19
19
|
interface MiniProgramComponents {
|
|
20
|
-
[name: string]: 'plugin' | 'component';
|
|
20
|
+
[name: string]: 'plugin' | 'component' | 'dynamicLib';
|
|
21
21
|
}
|
|
22
22
|
export declare function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }: {
|
|
23
23
|
filename: string;
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -124,8 +124,14 @@ function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, })
|
|
|
124
124
|
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(globalUsingComponents, componentsDir));
|
|
125
125
|
}
|
|
126
126
|
const jsonFile = findJsonFile((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(filename, inputDir)));
|
|
127
|
-
if (jsonFile
|
|
128
|
-
|
|
127
|
+
if (jsonFile) {
|
|
128
|
+
if (jsonFile.usingComponents) {
|
|
129
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(jsonFile.usingComponents, componentsDir));
|
|
130
|
+
}
|
|
131
|
+
// mp-baidu 特有
|
|
132
|
+
if (jsonFile.usingSwanComponents) {
|
|
133
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(jsonFile.usingSwanComponents, componentsDir));
|
|
134
|
+
}
|
|
129
135
|
}
|
|
130
136
|
return miniProgramComponents;
|
|
131
137
|
}
|
|
@@ -136,6 +142,9 @@ function findMiniProgramUsingComponent(usingComponents, componentsDir) {
|
|
|
136
142
|
if (path.includes('plugin://')) {
|
|
137
143
|
res[name] = 'plugin';
|
|
138
144
|
}
|
|
145
|
+
else if (path.includes('dynamicLib://')) {
|
|
146
|
+
res[name] = 'dynamicLib';
|
|
147
|
+
}
|
|
139
148
|
else if (componentsDir && path.includes(componentsDir + '/')) {
|
|
140
149
|
res[name] = 'component';
|
|
141
150
|
}
|
package/dist/json/mp/types.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface PageWindowOptions extends ShareWindowOptions {
|
|
|
21
21
|
component?: true;
|
|
22
22
|
disableScroll?: boolean;
|
|
23
23
|
usingComponents?: UsingComponents;
|
|
24
|
+
usingSwanComponents?: UsingComponents;
|
|
24
25
|
initialRenderingCache?: 'static' | string;
|
|
25
26
|
style?: Style;
|
|
26
27
|
singlePage?: SinglePage;
|
package/dist/mp/template.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import { EmittedAsset } from 'rollup';
|
|
1
|
+
import type { EmittedAsset } from 'rollup';
|
|
2
|
+
import type { ElementNode } from '@vue/compiler-core';
|
|
3
|
+
declare type LazyElementFn = (node: ElementNode, context: {
|
|
4
|
+
isMiniProgramComponent(name: string): 'plugin' | 'component' | 'dynamicLib' | undefined;
|
|
5
|
+
}) => {
|
|
6
|
+
[name: string]: {
|
|
7
|
+
name: 'on' | 'bind';
|
|
8
|
+
arg: string[];
|
|
9
|
+
}[];
|
|
10
|
+
} | boolean;
|
|
2
11
|
export interface MiniProgramCompilerOptions {
|
|
3
12
|
/**
|
|
4
13
|
* 需要延迟渲染的组件,通常是某个组件的某个事件会立刻触发,需要延迟到首次 render 之后,比如微信 editor 的 ready 事件,快手 switch 的 change
|
|
@@ -8,7 +17,7 @@ export interface MiniProgramCompilerOptions {
|
|
|
8
17
|
name: 'on' | 'bind';
|
|
9
18
|
arg: string[];
|
|
10
19
|
}[];
|
|
11
|
-
};
|
|
20
|
+
} | LazyElementFn;
|
|
12
21
|
event?: {
|
|
13
22
|
key?: boolean;
|
|
14
23
|
format?(name: string, opts: {
|
package/dist/uni_modules.js
CHANGED
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.parseDefines = exports.parseExports = exports.genUniModulesExports = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const shared_1 = require("@vue/shared");
|
|
10
9
|
const merge_1 = require("merge");
|
|
11
|
-
const json_1 = require("./json");
|
|
12
10
|
function genUniModulesExports() {
|
|
13
11
|
const uniModulesDir = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'uni_modules');
|
|
14
12
|
if (!fs_extra_1.default.existsSync(uniModulesDir)) {
|
|
@@ -22,7 +20,7 @@ function genUniModulesExports() {
|
|
|
22
20
|
if (!fs_extra_1.default.existsSync(pkgPath)) {
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
|
-
const exports = (_b = (_a =
|
|
23
|
+
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.exports;
|
|
26
24
|
if (exports) {
|
|
27
25
|
const [exportsImportCodes, exportsAssignCodes] = parseExports(process.env.UNI_PLATFORM === 'h5' ? 'web' : process.env.UNI_PLATFORM, `@/uni_modules/${uniModuleDir}`, exports);
|
|
28
26
|
importCodes.push(...exportsImportCodes);
|
|
@@ -86,17 +84,17 @@ exports.parseDefines = parseDefines;
|
|
|
86
84
|
function parseDefine(source, globalObject, define) {
|
|
87
85
|
const importCodes = [];
|
|
88
86
|
const assignCodes = [];
|
|
89
|
-
if (
|
|
87
|
+
if (typeof define === 'string') {
|
|
90
88
|
importCodes.push(`import ${define} from '${source}'`);
|
|
91
89
|
assignCodes.push(`${globalObject}.${define} = ${define}`);
|
|
92
90
|
}
|
|
93
|
-
else if (
|
|
91
|
+
else if (Array.isArray(define)) {
|
|
94
92
|
importCodes.push(`import { ${define.join(', ')} } from '${source}'`);
|
|
95
93
|
define.forEach((d) => {
|
|
96
94
|
assignCodes.push(`${globalObject}.${d} = ${d}`);
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
|
-
else
|
|
97
|
+
else {
|
|
100
98
|
const keys = Object.keys(define);
|
|
101
99
|
const specifiers = [];
|
|
102
100
|
keys.forEach((d) => {
|
|
@@ -36,6 +36,7 @@ const crypto_1 = require("crypto");
|
|
|
36
36
|
const utils_1 = require("../utils");
|
|
37
37
|
const utils_2 = require("../../../../vite/utils/utils");
|
|
38
38
|
const shared_1 = require("@vue/shared");
|
|
39
|
+
const utils_3 = require("../../../../utils");
|
|
39
40
|
exports.assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g;
|
|
40
41
|
// urls in JS must be quoted as strings, so when replacing them we need
|
|
41
42
|
// a different regex
|
|
@@ -248,7 +249,8 @@ function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, canI
|
|
|
248
249
|
const postfix = (search || '') + (hash || '');
|
|
249
250
|
const inputDir = (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR);
|
|
250
251
|
let fileName = file.startsWith(inputDir)
|
|
251
|
-
?
|
|
252
|
+
? // 需要处理 HBuilderX 项目中的 node_modules 目录
|
|
253
|
+
(0, utils_3.normalizeNodeModules)(path_1.default.posix.relative(inputDir, file))
|
|
252
254
|
: assetFileNamesToFileName(path_1.default.posix.join(config.build.assetsDir, '[name].[hash][extname]'), file, contentHash, content);
|
|
253
255
|
if (!map.has(contentHash)) {
|
|
254
256
|
map.set(contentHash, fileName);
|
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-3060420220922008",
|
|
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.18.13",
|
|
26
26
|
"@babel/parser": "^7.18.13",
|
|
27
27
|
"@babel/types": "^7.17.0",
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3060420220922008",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3060420220922008",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|