@dcloudio/uni-cli-shared 3.0.0-alpha-3030520211229003 → 3.0.0-alpha-3030720220111003
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/checkUpdate.js +1 -1
- package/dist/easycom.js +1 -1
- package/dist/logs/console.d.ts +4 -1
- package/dist/logs/console.js +5 -2
- package/dist/mp/ast.d.ts +4 -0
- package/dist/mp/ast.js +12 -0
- package/dist/mp/externalClasses.d.ts +5 -0
- package/dist/mp/externalClasses.js +42 -0
- package/dist/mp/index.d.ts +3 -1
- package/dist/mp/index.js +7 -2
- package/dist/mp/usingComponents.d.ts +0 -4
- package/dist/mp/usingComponents.js +1 -9
- package/dist/scripts.js +18 -4
- package/dist/vite/plugins/console.js +8 -6
- package/dist/vite/plugins/copy.js +1 -1
- package/dist/vite/plugins/cssScoped.js +2 -2
- package/dist/vite/plugins/inject.js +6 -4
- package/dist/vite/plugins/vitejs/plugins/css.js +1 -0
- package/dist/vite/utils/plugin.js +10 -1
- package/package.json +3 -3
package/dist/checkUpdate.js
CHANGED
|
@@ -14,7 +14,7 @@ const compare_versions_1 = __importDefault(require("compare-versions"));
|
|
|
14
14
|
const shared_1 = require("@vue/shared");
|
|
15
15
|
const json_1 = require("./json");
|
|
16
16
|
const hbx_1 = require("./hbx");
|
|
17
|
-
const debugCheckUpdate = (0, debug_1.default)('
|
|
17
|
+
const debugCheckUpdate = (0, debug_1.default)('uni:check-update');
|
|
18
18
|
const INTERVAL = 1000 * 60 * 60 * 24;
|
|
19
19
|
async function checkUpdate(options) {
|
|
20
20
|
if (process.env.CI) {
|
package/dist/easycom.js
CHANGED
|
@@ -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)('
|
|
16
|
+
const debugEasycom = (0, debug_1.default)('uni:easycom');
|
|
17
17
|
const easycoms = [];
|
|
18
18
|
const easycomsCache = new Map();
|
|
19
19
|
const easycomsInvalidCache = new Set();
|
package/dist/logs/console.d.ts
CHANGED
package/dist/logs/console.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.rewriteConsoleExpr = void 0;
|
|
|
7
7
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const F = '__f__';
|
|
10
|
-
function rewriteConsoleExpr(filename, code) {
|
|
10
|
+
function rewriteConsoleExpr(id, filename, code, sourceMap = false) {
|
|
11
11
|
filename = (0, utils_1.normalizePath)(filename);
|
|
12
12
|
const re = /(console\.(log|info|debug|warn|error))\(([^)]+)\)/g;
|
|
13
13
|
const locate = getLocator(code);
|
|
@@ -17,7 +17,10 @@ function rewriteConsoleExpr(filename, code) {
|
|
|
17
17
|
const [, expr, type] = match;
|
|
18
18
|
s.overwrite(match.index, match.index + expr.length + 1, F + `('${type}','at ${filename}:${locate(match.index).line + 1}',`);
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
code: s.toString(),
|
|
22
|
+
map: sourceMap ? s.generateMap({ source: id, hires: true }) : null,
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
exports.rewriteConsoleExpr = rewriteConsoleExpr;
|
|
23
26
|
function getLocator(source) {
|
package/dist/mp/ast.d.ts
ADDED
package/dist/mp/ast.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseProgram = void 0;
|
|
4
|
+
const parser_1 = require("@babel/parser");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function parseProgram(code, importer, { babelParserPlugins }) {
|
|
7
|
+
return (0, parser_1.parse)(code, {
|
|
8
|
+
plugins: (0, utils_1.normalizeParsePlugins)(importer, babelParserPlugins),
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
}).program;
|
|
11
|
+
}
|
|
12
|
+
exports.parseProgram = parseProgram;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Program } from '@babel/types';
|
|
2
|
+
export declare function hasExternalClasses(code: string): boolean;
|
|
3
|
+
export declare function findMiniProgramComponentExternalClasses(filename: string): string[] | undefined;
|
|
4
|
+
export declare function updateMiniProgramComponentExternalClasses(filename: string, classes: string[]): void;
|
|
5
|
+
export declare function parseExternalClasses(ast: Program): string[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseExternalClasses = exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.hasExternalClasses = void 0;
|
|
4
|
+
const types_1 = require("@babel/types");
|
|
5
|
+
const estree_walker_1 = require("estree-walker");
|
|
6
|
+
const externalClassesCache = new Map();
|
|
7
|
+
function hasExternalClasses(code) {
|
|
8
|
+
return code.includes('externalClasses');
|
|
9
|
+
}
|
|
10
|
+
exports.hasExternalClasses = hasExternalClasses;
|
|
11
|
+
function findMiniProgramComponentExternalClasses(filename) {
|
|
12
|
+
return externalClassesCache.get(filename);
|
|
13
|
+
}
|
|
14
|
+
exports.findMiniProgramComponentExternalClasses = findMiniProgramComponentExternalClasses;
|
|
15
|
+
function updateMiniProgramComponentExternalClasses(filename, classes) {
|
|
16
|
+
externalClassesCache.set(filename, classes);
|
|
17
|
+
}
|
|
18
|
+
exports.updateMiniProgramComponentExternalClasses = updateMiniProgramComponentExternalClasses;
|
|
19
|
+
function parseExternalClasses(ast) {
|
|
20
|
+
const classes = [];
|
|
21
|
+
estree_walker_1.walk(ast, {
|
|
22
|
+
enter(child, parent) {
|
|
23
|
+
if (!(0, types_1.isIdentifier)(child) || child.name !== 'externalClasses') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// export default { externalClasses: ['my-class'] }
|
|
27
|
+
if (!(0, types_1.isObjectProperty)(parent)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!(0, types_1.isArrayExpression)(parent.value)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
parent.value.elements.forEach((element) => {
|
|
34
|
+
if ((0, types_1.isStringLiteral)(element)) {
|
|
35
|
+
classes.push(element.value);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return classes;
|
|
41
|
+
}
|
|
42
|
+
exports.parseExternalClasses = parseExternalClasses;
|
package/dist/mp/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './ast';
|
|
1
2
|
export * from './nvue';
|
|
2
3
|
export * from './event';
|
|
3
4
|
export * from './style';
|
|
@@ -5,4 +6,5 @@ export * from './template';
|
|
|
5
6
|
export * from './constants';
|
|
6
7
|
export { HTML_TO_MINI_PROGRAM_TAGS } from './tags';
|
|
7
8
|
export { copyMiniProgramPluginJson } from './plugin';
|
|
8
|
-
export {
|
|
9
|
+
export { parseMainDescriptor, parseScriptDescriptor, parseTemplateDescriptor, transformDynamicImports, updateMiniProgramGlobalComponents, updateMiniProgramComponentsByMainFilename, updateMiniProgramComponentsByScriptFilename, updateMiniProgramComponentsByTemplateFilename, } from './usingComponents';
|
|
10
|
+
export { hasExternalClasses, parseExternalClasses, findMiniProgramComponentExternalClasses, updateMiniProgramComponentExternalClasses, } from './externalClasses';
|
package/dist/mp/index.js
CHANGED
|
@@ -10,7 +10,8 @@ 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.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.
|
|
13
|
+
exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.parseExternalClasses = exports.hasExternalClasses = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.copyMiniProgramPluginJson = exports.HTML_TO_MINI_PROGRAM_TAGS = void 0;
|
|
14
|
+
__exportStar(require("./ast"), exports);
|
|
14
15
|
__exportStar(require("./nvue"), exports);
|
|
15
16
|
__exportStar(require("./event"), exports);
|
|
16
17
|
__exportStar(require("./style"), exports);
|
|
@@ -21,7 +22,6 @@ Object.defineProperty(exports, "HTML_TO_MINI_PROGRAM_TAGS", { enumerable: true,
|
|
|
21
22
|
var plugin_1 = require("./plugin");
|
|
22
23
|
Object.defineProperty(exports, "copyMiniProgramPluginJson", { enumerable: true, get: function () { return plugin_1.copyMiniProgramPluginJson; } });
|
|
23
24
|
var usingComponents_1 = require("./usingComponents");
|
|
24
|
-
Object.defineProperty(exports, "parseProgram", { enumerable: true, get: function () { return usingComponents_1.parseProgram; } });
|
|
25
25
|
Object.defineProperty(exports, "parseMainDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseMainDescriptor; } });
|
|
26
26
|
Object.defineProperty(exports, "parseScriptDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseScriptDescriptor; } });
|
|
27
27
|
Object.defineProperty(exports, "parseTemplateDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseTemplateDescriptor; } });
|
|
@@ -30,3 +30,8 @@ Object.defineProperty(exports, "updateMiniProgramGlobalComponents", { enumerable
|
|
|
30
30
|
Object.defineProperty(exports, "updateMiniProgramComponentsByMainFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByMainFilename; } });
|
|
31
31
|
Object.defineProperty(exports, "updateMiniProgramComponentsByScriptFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByScriptFilename; } });
|
|
32
32
|
Object.defineProperty(exports, "updateMiniProgramComponentsByTemplateFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByTemplateFilename; } });
|
|
33
|
+
var externalClasses_1 = require("./externalClasses");
|
|
34
|
+
Object.defineProperty(exports, "hasExternalClasses", { enumerable: true, get: function () { return externalClasses_1.hasExternalClasses; } });
|
|
35
|
+
Object.defineProperty(exports, "parseExternalClasses", { enumerable: true, get: function () { return externalClasses_1.parseExternalClasses; } });
|
|
36
|
+
Object.defineProperty(exports, "findMiniProgramComponentExternalClasses", { enumerable: true, get: function () { return externalClasses_1.findMiniProgramComponentExternalClasses; } });
|
|
37
|
+
Object.defineProperty(exports, "updateMiniProgramComponentExternalClasses", { enumerable: true, get: function () { return externalClasses_1.updateMiniProgramComponentExternalClasses; } });
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ImportDeclaration, Program } from '@babel/types';
|
|
2
|
-
import { ParserPlugin } from '@babel/parser';
|
|
3
2
|
import type { PluginContext } from 'rollup';
|
|
4
3
|
declare type BindingComponents = Record<string, {
|
|
5
4
|
tag: string;
|
|
6
5
|
type: 'unknown' | 'setup' | 'self';
|
|
7
6
|
}>;
|
|
8
|
-
export declare function parseProgram(code: string, importer: string, { babelParserPlugins }: {
|
|
9
|
-
babelParserPlugins?: ParserPlugin[];
|
|
10
|
-
}): Program;
|
|
11
7
|
interface MainDescriptor {
|
|
12
8
|
imports: ImportDeclaration[];
|
|
13
9
|
script: string;
|
|
@@ -3,9 +3,8 @@ 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.transformDynamicImports = exports.parseScriptDescriptor = exports.parseTemplateDescriptor = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.parseMainDescriptor =
|
|
6
|
+
exports.transformDynamicImports = exports.parseScriptDescriptor = exports.parseTemplateDescriptor = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.parseMainDescriptor = void 0;
|
|
7
7
|
const types_1 = require("@babel/types");
|
|
8
|
-
const parser_1 = require("@babel/parser");
|
|
9
8
|
const estree_walker_1 = require("estree-walker");
|
|
10
9
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
11
10
|
const shared_1 = require("@vue/shared");
|
|
@@ -15,13 +14,6 @@ const constants_1 = require("../constants");
|
|
|
15
14
|
const utils_1 = require("../utils");
|
|
16
15
|
const utils_2 = require("../vite/utils");
|
|
17
16
|
const jsonFile_1 = require("../json/mp/jsonFile");
|
|
18
|
-
function parseProgram(code, importer, { babelParserPlugins }) {
|
|
19
|
-
return (0, parser_1.parse)(code, {
|
|
20
|
-
plugins: (0, utils_1.normalizeParsePlugins)(importer, babelParserPlugins),
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
}).program;
|
|
23
|
-
}
|
|
24
|
-
exports.parseProgram = parseProgram;
|
|
25
17
|
const mainDescriptors = new Map();
|
|
26
18
|
const scriptDescriptors = new Map();
|
|
27
19
|
const templateDescriptors = new Map();
|
package/dist/scripts.js
CHANGED
|
@@ -4,27 +4,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseScripts = void 0;
|
|
7
|
+
const shared_1 = require("@vue/shared");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
function parseScripts(name, pkgPath) {
|
|
9
|
-
var _a, _b
|
|
10
|
+
var _a, _b;
|
|
10
11
|
if (!fs_1.default.existsSync(pkgPath)) {
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
const pkg = JSON.parse(fs_1.default.readFileSync(pkgPath, 'utf8'));
|
|
14
|
-
const
|
|
15
|
+
const scripts = ((_a = pkg['uni-app']) === null || _a === void 0 ? void 0 : _a.scripts) || {};
|
|
16
|
+
const options = scripts[name];
|
|
15
17
|
if (!options) {
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
|
-
if (!((
|
|
20
|
+
if (!((_b = options.env) === null || _b === void 0 ? void 0 : _b.UNI_PLATFORM)) {
|
|
19
21
|
console.error(`package.json->uni-app->scripts->${name}->env->UNI_PLATFORM is required`);
|
|
20
22
|
process.exit(0);
|
|
21
23
|
}
|
|
22
24
|
const { UNI_PLATFORM, ...define } = options.env;
|
|
25
|
+
const context = options.define || {};
|
|
26
|
+
// 补充当前编译环境未定义的其他编译环境 define
|
|
27
|
+
Object.keys(scripts).forEach((scriptName) => {
|
|
28
|
+
if (scriptName !== name) {
|
|
29
|
+
const scriptDefine = scripts[scriptName].define || {};
|
|
30
|
+
Object.keys(scriptDefine).forEach((key) => {
|
|
31
|
+
if (!(0, shared_1.hasOwn)(context, key)) {
|
|
32
|
+
context[key] = false;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
23
37
|
return {
|
|
24
38
|
name: name,
|
|
25
39
|
platform: UNI_PLATFORM,
|
|
26
40
|
define,
|
|
27
|
-
context
|
|
41
|
+
context,
|
|
28
42
|
};
|
|
29
43
|
}
|
|
30
44
|
exports.parseScripts = parseScripts;
|
|
@@ -8,12 +8,17 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
8
8
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const console_1 = require("../../logs/console");
|
|
11
|
-
const
|
|
11
|
+
const utils_2 = require("../../vite/utils/utils");
|
|
12
|
+
const debugConsole = (0, debug_1.default)('uni:console');
|
|
12
13
|
function uniConsolePlugin(options) {
|
|
13
14
|
const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
|
|
15
|
+
let resolvedConfig;
|
|
14
16
|
return {
|
|
15
|
-
name: '
|
|
17
|
+
name: 'uni:console',
|
|
16
18
|
enforce: 'pre',
|
|
19
|
+
configResolved(config) {
|
|
20
|
+
resolvedConfig = config;
|
|
21
|
+
},
|
|
17
22
|
transform(code, id) {
|
|
18
23
|
if (!filter(id))
|
|
19
24
|
return null;
|
|
@@ -30,10 +35,7 @@ function uniConsolePlugin(options) {
|
|
|
30
35
|
return null;
|
|
31
36
|
}
|
|
32
37
|
debugConsole(id);
|
|
33
|
-
return
|
|
34
|
-
code: (0, console_1.rewriteConsoleExpr)(filename, code),
|
|
35
|
-
map: null,
|
|
36
|
-
};
|
|
38
|
+
return (0, console_1.rewriteConsoleExpr)(id, filename, code, (0, utils_2.withSourcemap)(resolvedConfig));
|
|
37
39
|
},
|
|
38
40
|
};
|
|
39
41
|
}
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const debug_1 = __importDefault(require("debug"));
|
|
9
9
|
const constants_1 = require("../../constants");
|
|
10
10
|
const preprocess_1 = require("../../preprocess");
|
|
11
|
-
const debugScoped = (0, debug_1.default)('
|
|
11
|
+
const debugScoped = (0, debug_1.default)('uni:scoped');
|
|
12
12
|
const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i;
|
|
13
13
|
function addScoped(code) {
|
|
14
14
|
if (SCOPED_RE.test(code)) {
|
|
@@ -18,7 +18,7 @@ function addScoped(code) {
|
|
|
18
18
|
}
|
|
19
19
|
function uniCssScopedPlugin({ filter } = { filter: () => false }) {
|
|
20
20
|
return {
|
|
21
|
-
name: '
|
|
21
|
+
name: 'uni:css-scoped',
|
|
22
22
|
enforce: 'pre',
|
|
23
23
|
transform(code, id) {
|
|
24
24
|
if (!filter(id))
|
|
@@ -11,8 +11,8 @@ const estree_walker_1 = require("estree-walker");
|
|
|
11
11
|
const shared_1 = require("@vue/shared");
|
|
12
12
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
|
-
const debugInject = (0, debug_1.default)('
|
|
15
|
-
const debugInjectTry = (0, debug_1.default)('
|
|
14
|
+
const debugInject = (0, debug_1.default)('uni:inject');
|
|
15
|
+
const debugInjectTry = (0, debug_1.default)('uni:inject-try');
|
|
16
16
|
function uniViteInjectPlugin(options) {
|
|
17
17
|
if (!options)
|
|
18
18
|
throw new Error('Missing options');
|
|
@@ -41,7 +41,7 @@ function uniViteInjectPlugin(options) {
|
|
|
41
41
|
const sourceMap = options.sourceMap !== false;
|
|
42
42
|
const callback = options.callback;
|
|
43
43
|
return {
|
|
44
|
-
name: '
|
|
44
|
+
name: 'uni:inject',
|
|
45
45
|
// 确保在 commonjs 之后,否则会混合 es6 module 与 cjs 的代码,导致 commonjs 失效
|
|
46
46
|
enforce: 'post',
|
|
47
47
|
transform(code, id) {
|
|
@@ -111,7 +111,9 @@ function uniViteInjectPlugin(options) {
|
|
|
111
111
|
if (reassignments.has(hash)) {
|
|
112
112
|
return false;
|
|
113
113
|
}
|
|
114
|
-
if (parent &&
|
|
114
|
+
if (parent &&
|
|
115
|
+
(0, utils_1.isAssignmentExpression)(parent) &&
|
|
116
|
+
parent.left === node) {
|
|
115
117
|
reassignments.add(hash);
|
|
116
118
|
return false;
|
|
117
119
|
}
|
|
@@ -501,6 +501,7 @@ async function minifyCSS(css, config) {
|
|
|
501
501
|
const { code, warnings } = await (0, esbuild_1.transform)(css, {
|
|
502
502
|
loader: 'css',
|
|
503
503
|
minify: true,
|
|
504
|
+
target: config.build.cssTarget || undefined,
|
|
504
505
|
});
|
|
505
506
|
if (warnings.length) {
|
|
506
507
|
const msgs = await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning' });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removePlugins = exports.replacePlugins = exports.injectCssPostPlugin = exports.injectCssPlugin = exports.injectAssetPlugin = void 0;
|
|
4
|
+
const shared_1 = require("@vue/shared");
|
|
4
5
|
const asset_1 = require("../plugins/vitejs/plugins/asset");
|
|
5
6
|
const css_1 = require("../plugins/vitejs/plugins/css");
|
|
6
7
|
function injectAssetPlugin(config) {
|
|
@@ -12,7 +13,15 @@ function injectCssPlugin(config) {
|
|
|
12
13
|
}
|
|
13
14
|
exports.injectCssPlugin = injectCssPlugin;
|
|
14
15
|
function injectCssPostPlugin(config, { chunkCssFilename, chunkCssCode, }) {
|
|
15
|
-
|
|
16
|
+
const newCssPostPlugin = (0, css_1.cssPostPlugin)(config, {
|
|
17
|
+
chunkCssFilename,
|
|
18
|
+
chunkCssCode,
|
|
19
|
+
});
|
|
20
|
+
const oldCssPostPlugin = config.plugins.find((p) => p.name === newCssPostPlugin.name);
|
|
21
|
+
// 直接覆盖原有方法,不能删除,替换,因为 unocss 在 pre 阶段已经获取到了旧的 css-post 插件对象
|
|
22
|
+
if (oldCssPostPlugin) {
|
|
23
|
+
(0, shared_1.extend)(oldCssPostPlugin, newCssPostPlugin);
|
|
24
|
+
}
|
|
16
25
|
}
|
|
17
26
|
exports.injectCssPostPlugin = injectCssPostPlugin;
|
|
18
27
|
function replacePlugins(plugins, config) {
|
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-3030720220111003",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@babel/core": "^7.16.5",
|
|
22
22
|
"@babel/parser": "^7.16.4",
|
|
23
23
|
"@babel/types": "^7.16.0",
|
|
24
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
25
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
24
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3030720220111003",
|
|
25
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3030720220111003",
|
|
26
26
|
"@rollup/pluginutils": "^4.1.2",
|
|
27
27
|
"@vue/compiler-core": "3.2.26",
|
|
28
28
|
"@vue/compiler-dom": "3.2.26",
|