@dcloudio/uni-cli-shared 3.0.0-alpha-3030020211126001 → 3.0.0-alpha-3030020211201002
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/env/index.d.ts +1 -1
- package/dist/env/index.js +2 -2
- package/dist/env/provide.d.ts +1 -1
- package/dist/env/provide.js +3 -3
- package/dist/json/app/pages/definePage.js +2 -2
- package/dist/json/mp/index.d.ts +1 -1
- package/dist/json/mp/index.js +2 -1
- package/dist/json/mp/jsonFile.d.ts +2 -1
- package/dist/json/mp/jsonFile.js +15 -3
- package/dist/json/mp/pages.d.ts +1 -0
- package/dist/json/mp/pages.js +11 -1
- package/dist/json/mp/project.d.ts +1 -0
- package/dist/json/mp/project.js +5 -1
- package/dist/json/pages.d.ts +9 -0
- package/dist/json/pages.js +24 -1
- package/dist/vite/plugins/cssScoped.d.ts +2 -4
- package/dist/vite/plugins/cssScoped.js +6 -18
- package/dist/vite/plugins/index.d.ts +2 -2
- package/dist/vite/plugins/index.js +3 -1
- package/dist/vite/plugins/inject.js +2 -0
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +1 -0
- package/dist/vite/plugins/vitejs/plugins/css.js +2 -1
- package/dist/vite/utils/url.d.ts +0 -1
- package/dist/vue/transforms/transformRef.js +2 -2
- package/dist/vue/utils.d.ts +1 -0
- package/dist/vue/utils.js +8 -1
- package/package.json +3 -3
package/dist/env/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { initDefine } from './define';
|
|
2
|
-
export {
|
|
2
|
+
export { initAppProvide } from './provide';
|
package/dist/env/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initAppProvide = exports.initDefine = void 0;
|
|
4
4
|
var define_1 = require("./define");
|
|
5
5
|
Object.defineProperty(exports, "initDefine", { enumerable: true, get: function () { return define_1.initDefine; } });
|
|
6
6
|
var provide_1 = require("./provide");
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "initAppProvide", { enumerable: true, get: function () { return provide_1.initAppProvide; } });
|
package/dist/env/provide.d.ts
CHANGED
package/dist/env/provide.js
CHANGED
|
@@ -3,10 +3,10 @@ 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.initAppProvide = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const libDir = path_1.default.resolve(__dirname, '../../lib');
|
|
9
|
-
function
|
|
9
|
+
function initAppProvide() {
|
|
10
10
|
const cryptoDefine = [path_1.default.join(libDir, 'crypto.js'), 'default'];
|
|
11
11
|
return {
|
|
12
12
|
__f__: ['@dcloudio/uni-shared', 'formatAppLog'],
|
|
@@ -15,4 +15,4 @@ function initProvide() {
|
|
|
15
15
|
'global.crypto': cryptoDefine,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
exports.
|
|
18
|
+
exports.initAppProvide = initAppProvide;
|
|
@@ -15,10 +15,10 @@ function definePageCode(pagesJson) {
|
|
|
15
15
|
if (pagePathWithExtname) {
|
|
16
16
|
if (process.env.UNI_APP_CODE_SPLITING) {
|
|
17
17
|
// 拆分页面
|
|
18
|
-
importPagesCode.push(`const ${pageIdentifier} = ()=>import('./${pagePathWithExtname}
|
|
18
|
+
importPagesCode.push(`const ${pageIdentifier} = ()=>import('./${pagePathWithExtname}')`);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
importPagesCode.push(`import ${pageIdentifier} from './${pagePathWithExtname}
|
|
21
|
+
importPagesCode.push(`import ${pageIdentifier} from './${pagePathWithExtname}'`);
|
|
22
22
|
}
|
|
23
23
|
definePagesCode.push(`__definePage('${pagePath}',${pageIdentifier})`);
|
|
24
24
|
}
|
package/dist/json/mp/index.d.ts
CHANGED
package/dist/json/mp/index.js
CHANGED
|
@@ -10,9 +10,10 @@ 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
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.parseMiniProgramProjectJson = exports.parseMiniProgramPagesJson = void 0;
|
|
13
|
+
exports.parseMiniProgramProjectJson = exports.parseMiniProgramPagesJson = exports.mergeMiniProgramAppJson = void 0;
|
|
14
14
|
__exportStar(require("./jsonFile"), exports);
|
|
15
15
|
var pages_1 = require("./pages");
|
|
16
|
+
Object.defineProperty(exports, "mergeMiniProgramAppJson", { enumerable: true, get: function () { return pages_1.mergeMiniProgramAppJson; } });
|
|
16
17
|
Object.defineProperty(exports, "parseMiniProgramPagesJson", { enumerable: true, get: function () { return pages_1.parseMiniProgramPagesJson; } });
|
|
17
18
|
var project_1 = require("./project");
|
|
18
19
|
Object.defineProperty(exports, "parseMiniProgramProjectJson", { enumerable: true, get: function () { return project_1.parseMiniProgramProjectJson; } });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentJson, PageWindowOptions, UsingComponents } from './types';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function isMiniProgramPageFile(file: string, inputDir?: string): boolean;
|
|
3
|
+
export declare function isMiniProgramPageSfcFile(file: string, inputDir?: string): boolean;
|
|
3
4
|
export declare function hasJsonFile(filename: string): boolean;
|
|
4
5
|
export declare function normalizeJsonFilename(filename: string): string;
|
|
5
6
|
export declare function findChangedJsonFiles(): Map<string, string>;
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
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.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = exports.
|
|
6
|
+
exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = exports.isMiniProgramPageSfcFile = exports.isMiniProgramPageFile = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const shared_1 = require("@vue/shared");
|
|
5
9
|
const utils_1 = require("../../utils");
|
|
6
10
|
const resolve_1 = require("../../resolve");
|
|
11
|
+
const utils_2 = require("../../vue/utils");
|
|
7
12
|
let appJsonCache = {};
|
|
8
13
|
const jsonFilesCache = new Map();
|
|
9
14
|
const jsonPagesCache = new Map();
|
|
10
15
|
const jsonComponentsCache = new Map();
|
|
11
16
|
const jsonUsingComponentsCache = new Map();
|
|
12
|
-
function
|
|
17
|
+
function isMiniProgramPageFile(file, inputDir) {
|
|
18
|
+
if (inputDir && path_1.default.isAbsolute(file)) {
|
|
19
|
+
file = (0, utils_1.normalizePath)(path_1.default.relative(inputDir, file));
|
|
20
|
+
}
|
|
13
21
|
return jsonPagesCache.has((0, utils_1.removeExt)(file));
|
|
14
22
|
}
|
|
15
|
-
exports.
|
|
23
|
+
exports.isMiniProgramPageFile = isMiniProgramPageFile;
|
|
24
|
+
function isMiniProgramPageSfcFile(file, inputDir) {
|
|
25
|
+
return (0, utils_2.isVueSfcFile)(file) && isMiniProgramPageFile(file, inputDir);
|
|
26
|
+
}
|
|
27
|
+
exports.isMiniProgramPageSfcFile = isMiniProgramPageSfcFile;
|
|
16
28
|
function hasJsonFile(filename) {
|
|
17
29
|
return (filename === 'app' ||
|
|
18
30
|
jsonPagesCache.has(filename) ||
|
package/dist/json/mp/pages.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export declare function parseMiniProgramPagesJson(jsonStr: string, platform: Uni
|
|
|
13
13
|
pageJsons: Record<string, PageWindowOptions>;
|
|
14
14
|
nvuePages: string[];
|
|
15
15
|
};
|
|
16
|
+
export declare function mergeMiniProgramAppJson(appJson: Record<string, any>, platformJson?: Record<string, any>): void;
|
|
16
17
|
export {};
|
package/dist/json/mp/pages.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.parseMiniProgramPagesJson = void 0;
|
|
6
|
+
exports.mergeMiniProgramAppJson = exports.parseMiniProgramPagesJson = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -11,10 +11,20 @@ const json_1 = require("../json");
|
|
|
11
11
|
const pages_1 = require("../pages");
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
const utils_2 = require("../../utils");
|
|
14
|
+
const project_1 = require("./project");
|
|
14
15
|
function parseMiniProgramPagesJson(jsonStr, platform, options = { subpackages: false }) {
|
|
15
16
|
return parsePagesJson(jsonStr, platform, options);
|
|
16
17
|
}
|
|
17
18
|
exports.parseMiniProgramPagesJson = parseMiniProgramPagesJson;
|
|
19
|
+
function mergeMiniProgramAppJson(appJson, platformJson = {}) {
|
|
20
|
+
Object.keys(platformJson).forEach((name) => {
|
|
21
|
+
if (!(0, project_1.isMiniProgramProjectJsonKey)(name) &&
|
|
22
|
+
!['usingComponents', 'optimization'].includes(name)) {
|
|
23
|
+
appJson[name] = platformJson[name];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.mergeMiniProgramAppJson = mergeMiniProgramAppJson;
|
|
18
28
|
function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, subpackages, windowOptionsMap, tabBarOptionsMap, tabBarItemOptionsMap, } = {
|
|
19
29
|
subpackages: false,
|
|
20
30
|
}) {
|
|
@@ -4,5 +4,6 @@ interface ParseMiniProgramProjectJsonOptions {
|
|
|
4
4
|
interface ProjectConfig {
|
|
5
5
|
projectname: string;
|
|
6
6
|
}
|
|
7
|
+
export declare function isMiniProgramProjectJsonKey(name: string): boolean;
|
|
7
8
|
export declare function parseMiniProgramProjectJson(jsonStr: string, platform: UniApp.PLATFORM, { template }: ParseMiniProgramProjectJsonOptions): ProjectConfig;
|
|
8
9
|
export {};
|
package/dist/json/mp/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMiniProgramProjectJson = void 0;
|
|
3
|
+
exports.parseMiniProgramProjectJson = exports.isMiniProgramProjectJsonKey = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const json_1 = require("../json");
|
|
6
6
|
const projectKeys = [
|
|
@@ -18,6 +18,10 @@ const projectKeys = [
|
|
|
18
18
|
'scripts',
|
|
19
19
|
'cloudbaseRoot',
|
|
20
20
|
];
|
|
21
|
+
function isMiniProgramProjectJsonKey(name) {
|
|
22
|
+
return projectKeys.includes(name);
|
|
23
|
+
}
|
|
24
|
+
exports.isMiniProgramProjectJsonKey = isMiniProgramProjectJsonKey;
|
|
21
25
|
function parseMiniProgramProjectJson(jsonStr, platform, { template }) {
|
|
22
26
|
const project = JSON.parse(JSON.stringify(template));
|
|
23
27
|
const manifestJson = (0, json_1.parseJson)(jsonStr);
|
package/dist/json/pages.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
export declare function isUniPageFile(file: string, inputDir?: string): boolean;
|
|
2
|
+
export declare function isUniPageSfcFile(file: string, inputDir?: string): boolean;
|
|
1
3
|
export declare const parsePagesJson: (inputDir: string, platform: UniApp.PLATFORM, normalize?: boolean) => UniApp.PagesJson;
|
|
2
4
|
export declare const parsePagesJsonOnce: (inputDir: string, platform: UniApp.PLATFORM, normalize?: boolean) => UniApp.PagesJson;
|
|
5
|
+
/**
|
|
6
|
+
* 目前 App 和 H5 使用了该方法
|
|
7
|
+
* @param jsonStr
|
|
8
|
+
* @param platform
|
|
9
|
+
* @param param2
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
3
12
|
export declare function normalizePagesJson(jsonStr: string, platform: UniApp.PLATFORM, { subpackages, }?: {
|
|
4
13
|
subpackages: boolean;
|
|
5
14
|
}): UniApp.PagesJson;
|
package/dist/json/pages.js
CHANGED
|
@@ -3,13 +3,26 @@ 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.normalizePagesRoute = exports.removePlatformStyle = exports.validatePages = exports.normalizePagesJson = exports.parsePagesJsonOnce = exports.parsePagesJson = void 0;
|
|
6
|
+
exports.normalizePagesRoute = exports.removePlatformStyle = exports.validatePages = exports.normalizePagesJson = exports.parsePagesJsonOnce = exports.parsePagesJson = exports.isUniPageSfcFile = exports.isUniPageFile = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
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 utils_2 = require("../vue/utils");
|
|
14
|
+
const pagesCacheSet = new Set();
|
|
15
|
+
function isUniPageFile(file, inputDir = process.env.UNI_INPUT_DIR) {
|
|
16
|
+
if (inputDir && path_1.default.isAbsolute(file)) {
|
|
17
|
+
file = (0, utils_1.normalizePath)(path_1.default.relative(inputDir, file));
|
|
18
|
+
}
|
|
19
|
+
return pagesCacheSet.has((0, utils_1.removeExt)(file));
|
|
20
|
+
}
|
|
21
|
+
exports.isUniPageFile = isUniPageFile;
|
|
22
|
+
function isUniPageSfcFile(file, inputDir = process.env.UNI_INPUT_DIR) {
|
|
23
|
+
return (0, utils_2.isVueSfcFile)(file) && isUniPageFile(file, inputDir);
|
|
24
|
+
}
|
|
25
|
+
exports.isUniPageSfcFile = isUniPageSfcFile;
|
|
13
26
|
const parsePagesJson = (inputDir, platform, normalize = true) => {
|
|
14
27
|
const jsonStr = fs_1.default.readFileSync(path_1.default.join(inputDir, 'pages.json'), 'utf8');
|
|
15
28
|
if (normalize) {
|
|
@@ -19,6 +32,13 @@ const parsePagesJson = (inputDir, platform, normalize = true) => {
|
|
|
19
32
|
};
|
|
20
33
|
exports.parsePagesJson = parsePagesJson;
|
|
21
34
|
exports.parsePagesJsonOnce = (0, uni_shared_1.once)(exports.parsePagesJson);
|
|
35
|
+
/**
|
|
36
|
+
* 目前 App 和 H5 使用了该方法
|
|
37
|
+
* @param jsonStr
|
|
38
|
+
* @param platform
|
|
39
|
+
* @param param2
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
22
42
|
function normalizePagesJson(jsonStr, platform, { subpackages, } = { subpackages: false }) {
|
|
23
43
|
let pagesJson = {
|
|
24
44
|
pages: [],
|
|
@@ -66,6 +86,9 @@ function normalizePagesJson(jsonStr, platform, { subpackages, } = { subpackages:
|
|
|
66
86
|
delete pagesJson.tabBar;
|
|
67
87
|
}
|
|
68
88
|
}
|
|
89
|
+
// 缓存页面列表
|
|
90
|
+
pagesCacheSet.clear();
|
|
91
|
+
pagesJson.pages.forEach((page) => pagesCacheSet.add(page.path));
|
|
69
92
|
return pagesJson;
|
|
70
93
|
}
|
|
71
94
|
exports.normalizePagesJson = normalizePagesJson;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
import { FilterPattern } from '@rollup/pluginutils';
|
|
3
2
|
interface UniCssScopedPluginOptions {
|
|
4
|
-
|
|
5
|
-
exclude?: FilterPattern;
|
|
3
|
+
filter: (id: string) => boolean;
|
|
6
4
|
}
|
|
7
|
-
export declare function uniCssScopedPlugin(
|
|
5
|
+
export declare function uniCssScopedPlugin({ filter }?: UniCssScopedPluginOptions): Plugin;
|
|
8
6
|
export {};
|
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.uniCssScopedPlugin = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const debug_1 = __importDefault(require("debug"));
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
9
|
const constants_1 = require("../../constants");
|
|
11
|
-
const pluginutils_1 = require("@rollup/pluginutils");
|
|
12
10
|
const preprocess_1 = require("../../preprocess");
|
|
13
11
|
const debugScoped = (0, debug_1.default)('vite:uni:scoped');
|
|
14
12
|
const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i;
|
|
@@ -18,28 +16,18 @@ function addScoped(code) {
|
|
|
18
16
|
}
|
|
19
17
|
return code.replace(/(<style\b[^><]*)>/gi, '$1 scoped>');
|
|
20
18
|
}
|
|
21
|
-
function uniCssScopedPlugin(
|
|
22
|
-
const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
|
|
19
|
+
function uniCssScopedPlugin({ filter } = { filter: () => false }) {
|
|
23
20
|
return {
|
|
24
21
|
name: 'vite:uni-css-scoped',
|
|
25
22
|
enforce: 'pre',
|
|
26
23
|
transform(code, id) {
|
|
27
|
-
if (id.endsWith('App.vue')) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
24
|
if (!filter(id))
|
|
31
25
|
return null;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
debugScoped(id);
|
|
38
|
-
return {
|
|
39
|
-
code: addScoped(code),
|
|
40
|
-
map: null,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
26
|
+
debugScoped(id);
|
|
27
|
+
return {
|
|
28
|
+
code: addScoped(code),
|
|
29
|
+
map: null,
|
|
30
|
+
};
|
|
43
31
|
},
|
|
44
32
|
// 仅 h5
|
|
45
33
|
handleHotUpdate(ctx) {
|
|
@@ -4,5 +4,5 @@ export * from './inject';
|
|
|
4
4
|
export * from './mainJs';
|
|
5
5
|
export * from './jsonJs';
|
|
6
6
|
export * from './console';
|
|
7
|
-
export { assetPlugin } from './vitejs/plugins/asset';
|
|
8
|
-
export { isCSSRequest, cssPlugin, cssPostPlugin } from './vitejs/plugins/css';
|
|
7
|
+
export { assetPlugin, getAssetHash } from './vitejs/plugins/asset';
|
|
8
|
+
export { isCSSRequest, cssPlugin, cssPostPlugin, minifyCSS, } from './vitejs/plugins/css';
|
|
@@ -10,7 +10,7 @@ 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
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.cssPostPlugin = exports.cssPlugin = exports.isCSSRequest = exports.assetPlugin = void 0;
|
|
13
|
+
exports.minifyCSS = exports.cssPostPlugin = exports.cssPlugin = exports.isCSSRequest = exports.getAssetHash = exports.assetPlugin = void 0;
|
|
14
14
|
__exportStar(require("./cssScoped"), exports);
|
|
15
15
|
__exportStar(require("./copy"), exports);
|
|
16
16
|
__exportStar(require("./inject"), exports);
|
|
@@ -19,7 +19,9 @@ __exportStar(require("./jsonJs"), exports);
|
|
|
19
19
|
__exportStar(require("./console"), exports);
|
|
20
20
|
var asset_1 = require("./vitejs/plugins/asset");
|
|
21
21
|
Object.defineProperty(exports, "assetPlugin", { enumerable: true, get: function () { return asset_1.assetPlugin; } });
|
|
22
|
+
Object.defineProperty(exports, "getAssetHash", { enumerable: true, get: function () { return asset_1.getAssetHash; } });
|
|
22
23
|
var css_1 = require("./vitejs/plugins/css");
|
|
23
24
|
Object.defineProperty(exports, "isCSSRequest", { enumerable: true, get: function () { return css_1.isCSSRequest; } });
|
|
24
25
|
Object.defineProperty(exports, "cssPlugin", { enumerable: true, get: function () { return css_1.cssPlugin; } });
|
|
25
26
|
Object.defineProperty(exports, "cssPostPlugin", { enumerable: true, get: function () { return css_1.cssPostPlugin; } });
|
|
27
|
+
Object.defineProperty(exports, "minifyCSS", { enumerable: true, get: function () { return css_1.minifyCSS; } });
|
|
@@ -42,6 +42,8 @@ function uniViteInjectPlugin(options) {
|
|
|
42
42
|
const callback = options.callback;
|
|
43
43
|
return {
|
|
44
44
|
name: 'vite:uni-inject',
|
|
45
|
+
// 确保在 commonjs 之后,否则会混合 es6 module 与 cjs 的代码,导致 commonjs 失效
|
|
46
|
+
enforce: 'post',
|
|
45
47
|
transform(code, id) {
|
|
46
48
|
if (!filter(id))
|
|
47
49
|
return null;
|
|
@@ -38,6 +38,7 @@ export declare function cssPostPlugin(config: ResolvedConfig, { chunkCssFilename
|
|
|
38
38
|
chunkCssCode: (filename: string, cssCode: string) => string;
|
|
39
39
|
}): Plugin;
|
|
40
40
|
export declare const cssUrlRE: RegExp;
|
|
41
|
+
export declare function minifyCSS(css: string, config: ResolvedConfig): Promise<string>;
|
|
41
42
|
export interface StylePreprocessorResults {
|
|
42
43
|
code: string;
|
|
43
44
|
map?: object;
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.cssUrlRE = exports.cssPostPlugin = exports.cssPlugin = exports.isDirectCSSRequest = exports.isCSSRequest = exports.cssLangRE = void 0;
|
|
25
|
+
exports.minifyCSS = exports.cssUrlRE = exports.cssPostPlugin = exports.cssPlugin = exports.isDirectCSSRequest = exports.isCSSRequest = exports.cssLangRE = void 0;
|
|
26
26
|
const fs_1 = __importDefault(require("fs"));
|
|
27
27
|
const path_1 = __importDefault(require("path"));
|
|
28
28
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
@@ -508,6 +508,7 @@ async function minifyCSS(css, config) {
|
|
|
508
508
|
}
|
|
509
509
|
return code;
|
|
510
510
|
}
|
|
511
|
+
exports.minifyCSS = minifyCSS;
|
|
511
512
|
const AtImportHoistPlugin = () => {
|
|
512
513
|
return {
|
|
513
514
|
postcssPlugin: 'vite-hoist-at-imports',
|
package/dist/vite/utils/url.d.ts
CHANGED
|
@@ -17,11 +17,11 @@ function addVueRef(node, context) {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
if (refProp.type === 6 /* ATTRIBUTE */) {
|
|
20
|
-
refProp.name = '
|
|
20
|
+
refProp.name = 'u-' + utils_1.VUE_REF;
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
23
|
;
|
|
24
|
-
refProp.arg.content = '
|
|
24
|
+
refProp.arg.content = 'u-' + utils_1.VUE_REF;
|
|
25
25
|
}
|
|
26
26
|
return (0, utils_1.addStaticClass)(node,
|
|
27
27
|
// ref-in-for
|
package/dist/vue/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AttributeNode, ComponentNode, DirectiveNode, ElementNode, RootNode, ExpressionNode, TemplateChildNode, TransformContext } from '@vue/compiler-core';
|
|
2
2
|
export declare const VUE_REF = "r";
|
|
3
3
|
export declare const VUE_REF_IN_FOR = "r-i-f";
|
|
4
|
+
export declare function isVueSfcFile(id: string): boolean;
|
|
4
5
|
export declare function isUserComponent(node: RootNode | TemplateChildNode, context: {
|
|
5
6
|
isBuiltInComponent: TransformContext['isBuiltInComponent'];
|
|
6
7
|
}): node is ComponentNode;
|
package/dist/vue/utils.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBaseNodeTransforms = exports.createUniVueTransformAssetUrls = exports.createBindDirectiveNode = exports.createOnDirectiveNode = exports.createDirectiveNode = exports.addStaticClass = exports.createAttributeNode = exports.isUserComponent = exports.VUE_REF_IN_FOR = exports.VUE_REF = void 0;
|
|
3
|
+
exports.getBaseNodeTransforms = exports.createUniVueTransformAssetUrls = exports.createBindDirectiveNode = exports.createOnDirectiveNode = exports.createDirectiveNode = exports.addStaticClass = exports.createAttributeNode = exports.isUserComponent = exports.isVueSfcFile = exports.VUE_REF_IN_FOR = exports.VUE_REF = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
6
6
|
const compiler_core_1 = require("@vue/compiler-core");
|
|
7
7
|
const templateTransformAssetUrl_1 = require("./transforms/templateTransformAssetUrl");
|
|
8
8
|
const templateTransformSrcset_1 = require("./transforms/templateTransformSrcset");
|
|
9
|
+
const url_1 = require("../vite/utils/url");
|
|
10
|
+
const constants_1 = require("../constants");
|
|
9
11
|
exports.VUE_REF = 'r';
|
|
10
12
|
exports.VUE_REF_IN_FOR = 'r-i-f';
|
|
13
|
+
function isVueSfcFile(id) {
|
|
14
|
+
const { filename, query } = (0, url_1.parseVueRequest)(id);
|
|
15
|
+
return constants_1.EXTNAME_VUE_RE.test(filename) && !query.vue;
|
|
16
|
+
}
|
|
17
|
+
exports.isVueSfcFile = isVueSfcFile;
|
|
11
18
|
function isUserComponent(node, context) {
|
|
12
19
|
return (node.type === 1 /* ELEMENT */ &&
|
|
13
20
|
node.tagType === 1 /* COMPONENT */ &&
|
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-3030020211201002",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/parser": "^7.15.0",
|
|
22
22
|
"@babel/types": "^7.15.0",
|
|
23
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
24
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
23
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3030020211201002",
|
|
24
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3030020211201002",
|
|
25
25
|
"@rollup/pluginutils": "^4.1.1",
|
|
26
26
|
"@vue/compiler-core": "3.2.23",
|
|
27
27
|
"@vue/compiler-dom": "3.2.23",
|