@dcloudio/uni-cli-shared 3.0.0-alpha-3030820220114009 → 3.0.0-alpha-3031120220221001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export declare const EXTNAME_VUE_RE: RegExp;
|
|
|
7
7
|
export declare const EXTNAME_JS_RE: RegExp;
|
|
8
8
|
export declare const EXTNAME_TS_RE: RegExp;
|
|
9
9
|
export declare const extensions: string[];
|
|
10
|
+
export declare const PAGES_JSON_JS = "pages-json-js";
|
|
11
|
+
export declare const MANIFEST_JSON_JS = "manifest-json-js";
|
|
12
|
+
export declare const JSON_JS_MAP: {
|
|
13
|
+
readonly 'pages.json': "pages-json-js";
|
|
14
|
+
readonly 'manifest.json': "manifest-json-js";
|
|
15
|
+
};
|
|
10
16
|
export declare const ASSETS_INLINE_LIMIT: number;
|
|
11
17
|
export declare const APP_SERVICE_FILENAME = "app-service.js";
|
|
12
18
|
export declare const BINDING_COMPONENTS = "__BINDING_COMPONENTS__";
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
3
|
+
exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
4
4
|
exports.PUBLIC_DIR = 'static';
|
|
5
5
|
exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
|
|
6
6
|
exports.EXTNAME_TS = ['.ts', '.tsx'];
|
|
@@ -17,6 +17,12 @@ exports.extensions = [
|
|
|
17
17
|
'.tsx',
|
|
18
18
|
'.json',
|
|
19
19
|
].concat(exports.EXTNAME_VUE);
|
|
20
|
+
exports.PAGES_JSON_JS = 'pages-json-js';
|
|
21
|
+
exports.MANIFEST_JSON_JS = 'manifest-json-js';
|
|
22
|
+
exports.JSON_JS_MAP = {
|
|
23
|
+
'pages.json': exports.PAGES_JSON_JS,
|
|
24
|
+
'manifest.json': exports.MANIFEST_JSON_JS,
|
|
25
|
+
};
|
|
20
26
|
exports.ASSETS_INLINE_LIMIT = 40 * 1024;
|
|
21
27
|
exports.APP_SERVICE_FILENAME = 'app-service.js';
|
|
22
28
|
exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
|
|
@@ -16,8 +16,12 @@ export declare function isMiniProgramUsingComponent(name: string, options: {
|
|
|
16
16
|
inputDir: string;
|
|
17
17
|
componentsDir?: string;
|
|
18
18
|
}): boolean;
|
|
19
|
+
interface MiniProgramComponents {
|
|
20
|
+
[name: string]: 'plugin' | 'component';
|
|
21
|
+
}
|
|
19
22
|
export declare function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }: {
|
|
20
23
|
filename: string;
|
|
21
24
|
inputDir: string;
|
|
22
25
|
componentsDir?: string;
|
|
23
|
-
}):
|
|
26
|
+
}): MiniProgramComponents;
|
|
27
|
+
export {};
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -103,28 +103,31 @@ function addMiniProgramUsingComponents(filename, json) {
|
|
|
103
103
|
}
|
|
104
104
|
exports.addMiniProgramUsingComponents = addMiniProgramUsingComponents;
|
|
105
105
|
function isMiniProgramUsingComponent(name, options) {
|
|
106
|
-
return findMiniProgramUsingComponents(options)
|
|
106
|
+
return !!findMiniProgramUsingComponents(options)[name];
|
|
107
107
|
}
|
|
108
108
|
exports.isMiniProgramUsingComponent = isMiniProgramUsingComponent;
|
|
109
109
|
function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }) {
|
|
110
|
-
if (!componentsDir) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
110
|
const globalUsingComponents = appJsonCache && appJsonCache.usingComponents;
|
|
114
|
-
const miniProgramComponents =
|
|
111
|
+
const miniProgramComponents = {};
|
|
115
112
|
if (globalUsingComponents) {
|
|
116
|
-
|
|
113
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(globalUsingComponents, componentsDir));
|
|
117
114
|
}
|
|
118
115
|
const jsonFile = findJsonFile((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(filename, inputDir)));
|
|
119
116
|
if (jsonFile === null || jsonFile === void 0 ? void 0 : jsonFile.usingComponents) {
|
|
120
|
-
|
|
117
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(jsonFile.usingComponents, componentsDir));
|
|
121
118
|
}
|
|
122
119
|
return miniProgramComponents;
|
|
123
120
|
}
|
|
124
121
|
exports.findMiniProgramUsingComponents = findMiniProgramUsingComponents;
|
|
125
122
|
function findMiniProgramUsingComponent(usingComponents, componentsDir) {
|
|
126
|
-
return Object.keys(usingComponents).
|
|
123
|
+
return Object.keys(usingComponents).reduce((res, name) => {
|
|
127
124
|
const path = usingComponents[name];
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
if (componentsDir && path.includes(componentsDir + '/')) {
|
|
126
|
+
res[name] = 'component';
|
|
127
|
+
}
|
|
128
|
+
else if (path.includes('plugin://')) {
|
|
129
|
+
res[name] = 'plugin';
|
|
130
|
+
}
|
|
131
|
+
return res;
|
|
132
|
+
}, {});
|
|
130
133
|
}
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.defineUniManifestJsonPlugin = exports.defineUniPagesJsonPlugin = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
exports.defineUniPagesJsonPlugin = createDefineJsonJsPlugin('pages.json');
|
|
11
12
|
exports.defineUniManifestJsonPlugin = createDefineJsonJsPlugin('manifest.json');
|
|
12
13
|
function createDefineJsonJsPlugin(name) {
|
|
13
|
-
const JSON_JS = name
|
|
14
|
+
const JSON_JS = constants_1.JSON_JS_MAP[name];
|
|
14
15
|
return function (createVitePlugin) {
|
|
15
16
|
const opts = {
|
|
16
17
|
resolvedConfig: {},
|
|
@@ -23,18 +24,20 @@ function createDefineJsonJsPlugin(name) {
|
|
|
23
24
|
const origResolveId = plugin.resolveId;
|
|
24
25
|
const origConfigResolved = plugin.configResolved;
|
|
25
26
|
let jsonPath = '';
|
|
27
|
+
let jsonJsPath = '';
|
|
26
28
|
plugin.resolveId = function (id, importer, options) {
|
|
27
29
|
const res = origResolveId && origResolveId.call(this, id, importer, options);
|
|
28
30
|
if (res) {
|
|
29
31
|
return res;
|
|
30
32
|
}
|
|
31
33
|
if (id.endsWith(JSON_JS)) {
|
|
32
|
-
return
|
|
34
|
+
return jsonJsPath;
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
plugin.configResolved = function (config) {
|
|
36
38
|
opts.resolvedConfig = config;
|
|
37
39
|
jsonPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, name));
|
|
40
|
+
jsonJsPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, JSON_JS));
|
|
38
41
|
return origConfigResolved && origConfigResolved(config);
|
|
39
42
|
};
|
|
40
43
|
plugin.load = function (id, ssr) {
|
|
@@ -33,6 +33,7 @@ const utils_1 = require("../utils");
|
|
|
33
33
|
const asset_1 = require("./asset");
|
|
34
34
|
const esbuild_1 = require("esbuild");
|
|
35
35
|
const preprocess_1 = require("../../../../preprocess");
|
|
36
|
+
const constants_1 = require("../../../../constants");
|
|
36
37
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
37
38
|
exports.cssLangRE = new RegExp(cssLangs);
|
|
38
39
|
const cssModuleRE = new RegExp(`\\.module${cssLangs}`);
|
|
@@ -114,7 +115,7 @@ function findCssModuleIds(moduleId, cssModuleIds, seen) {
|
|
|
114
115
|
const moduleInfo = this.getModuleInfo(moduleId);
|
|
115
116
|
if (moduleInfo) {
|
|
116
117
|
moduleInfo.importedIds.forEach((id) => {
|
|
117
|
-
if (id.includes(
|
|
118
|
+
if (id.includes(constants_1.PAGES_JSON_JS)) {
|
|
118
119
|
// 查询main.js时,需要忽略pages.json.js,否则会把所有页面样式加进来
|
|
119
120
|
return;
|
|
120
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3031120220221001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"url": "https://github.com/dcloudio/uni-app/issues"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@babel/core": "^7.
|
|
22
|
-
"@babel/parser": "^7.16.
|
|
21
|
+
"@babel/core": "^7.17.2",
|
|
22
|
+
"@babel/parser": "^7.16.4",
|
|
23
23
|
"@babel/types": "^7.16.8",
|
|
24
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
25
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
24
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3031120220221001",
|
|
25
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3031120220221001",
|
|
26
26
|
"@rollup/pluginutils": "^4.1.2",
|
|
27
|
-
"@vue/compiler-core": "3.2.
|
|
28
|
-
"@vue/compiler-dom": "3.2.
|
|
29
|
-
"@vue/compiler-sfc": "3.2.
|
|
30
|
-
"@vue/server-renderer": "3.2.
|
|
31
|
-
"@vue/shared": "3.2.
|
|
27
|
+
"@vue/compiler-core": "3.2.31",
|
|
28
|
+
"@vue/compiler-dom": "3.2.31",
|
|
29
|
+
"@vue/compiler-sfc": "3.2.31",
|
|
30
|
+
"@vue/server-renderer": "3.2.31",
|
|
31
|
+
"@vue/shared": "3.2.31",
|
|
32
32
|
"autoprefixer": "^10.4.2",
|
|
33
33
|
"base64url": "^3.0.1",
|
|
34
34
|
"chokidar": "^3.5.3",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"@types/mime": "^2.0.3",
|
|
64
64
|
"@types/module-alias": "^2.0.1",
|
|
65
65
|
"@types/stylus": "^0.48.36",
|
|
66
|
-
"postcss": "^8.4.
|
|
66
|
+
"postcss": "^8.4.6"
|
|
67
67
|
}
|
|
68
68
|
}
|