@dcloudio/uni-cli-shared 3.0.0-alpha-3021220211105012 → 3.0.0-alpha-3021320211116001

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.
@@ -4,6 +4,7 @@ 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
6
  export declare const ASSETS_INLINE_LIMIT: number;
7
+ export declare const APP_SERVICE_FILENAME = "app-service.js";
7
8
  export declare const BINDING_COMPONENTS = "__BINDING_COMPONENTS__";
8
9
  export declare const PAGE_EXTNAME_APP: string[];
9
10
  export declare const PAGE_EXTNAME: string[];
package/dist/constants.js CHANGED
@@ -1,12 +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.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;
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.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
9
  exports.ASSETS_INLINE_LIMIT = 40 * 1024;
10
+ exports.APP_SERVICE_FILENAME = 'app-service.js';
10
11
  exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
11
12
  // APP 平台解析页面后缀的优先级
12
13
  exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js'];
@@ -4,6 +4,7 @@ export declare function initDefine(stringifyBoolean?: boolean): {
4
4
  'process.env.UNI_APP_ID': string;
5
5
  'process.env.UNI_APP_NAME': string;
6
6
  'process.env.UNI_PLATFORM': string;
7
+ 'process.env.UNI_SUBPACKAGE': string;
7
8
  'process.env.UNI_COMPILER_VERSION': string;
8
9
  'process.env.RUN_BY_HBUILDERX': string | boolean;
9
10
  'process.env.UNI_AUTOMATOR_WS_ENDPOINT': string;
@@ -15,6 +15,7 @@ function initDefine(stringifyBoolean = false) {
15
15
  'process.env.UNI_APP_ID': JSON.stringify(manifestJson.appid || ''),
16
16
  'process.env.UNI_APP_NAME': JSON.stringify(manifestJson.name || ''),
17
17
  'process.env.UNI_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM),
18
+ 'process.env.UNI_SUBPACKAGE': JSON.stringify(process.env.UNI_SUBPACKAGE),
18
19
  'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION),
19
20
  'process.env.RUN_BY_HBUILDERX': stringifyBoolean
20
21
  ? JSON.stringify(isRunByHBuilderX)
package/dist/hbx/alias.js CHANGED
@@ -22,6 +22,12 @@ function initModuleAlias() {
22
22
  }
23
23
  }
24
24
  exports.initModuleAlias = initModuleAlias;
25
+ function supportAutoInstallPlugin() {
26
+ return true;
27
+ }
28
+ function sendSignal(lang) {
29
+ return console.error(`%HXRunUniAPPPluginName%${lang}%HXRunUniAPPPluginName%`);
30
+ }
25
31
  exports.moduleAliasFormatter = {
26
32
  test(msg) {
27
33
  return msg.includes('Preprocessor dependency');
@@ -42,7 +48,9 @@ exports.moduleAliasFormatter = {
42
48
  preprocessor = 'compile-stylus';
43
49
  }
44
50
  if (lang) {
45
- return `预编译器错误:代码使用了${lang}语言,但未安装相应的编译器插件,请前往插件市场安装该插件:
51
+ const autoInstall = supportAutoInstallPlugin();
52
+ autoInstall && sendSignal(preprocessor);
53
+ return `预编译器错误:代码使用了${lang}语言,但未安装相应的编译器插件,${autoInstall ? '正在从' : '请前往'}插件市场安装该插件:
46
54
  https://ext.dcloud.net.cn/plugin?name=${preprocessor}`;
47
55
  }
48
56
  return msg;
package/dist/hbx/env.js CHANGED
@@ -10,7 +10,10 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
10
10
  exports.isInHBuilderX = (0, uni_shared_1.once)(() => {
11
11
  try {
12
12
  const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json'));
13
- return name === 'about';
13
+ if (name === 'about') {
14
+ process.env.UNI_HBUILDERX_PLUGINS = path_1.default.resolve(process.cwd(), '..');
15
+ return true;
16
+ }
14
17
  }
15
18
  catch (e) {
16
19
  // console.error(e)
@@ -1 +1,4 @@
1
+ export declare const APP_CONFUSION_FILENAME = "app-confusion.js";
2
+ export declare function isConfusionFile(filename: string): boolean;
3
+ export declare function hasConfusionFile(inputDir?: string): boolean;
1
4
  export declare function initConfusion(manifestJson: Record<string, any>): void;
@@ -3,33 +3,75 @@ 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.initConfusion = void 0;
6
+ exports.initConfusion = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- function initConfusion(manifestJson) {
9
- var _a;
10
- if (!((_a = manifestJson.plus.confusion) === null || _a === void 0 ? void 0 : _a.resources)) {
11
- return;
8
+ const utils_1 = require("../../../utils");
9
+ const constants_1 = require("../../../constants");
10
+ const manifest_1 = require("../../manifest");
11
+ function isJsFile(filename) {
12
+ return constants_1.EXTNAME_JS_RE.test(filename);
13
+ }
14
+ function isStaticJsFile(filename) {
15
+ return (filename.indexOf('hybrid/html') === 0 ||
16
+ filename.indexOf('static/') === 0 ||
17
+ filename.indexOf('/static/') !== -1); // subpackages, uni_modules 中的 static 目录
18
+ }
19
+ const dynamicConfusionJsFiles = [];
20
+ exports.APP_CONFUSION_FILENAME = 'app-confusion.js';
21
+ function isConfusionFile(filename) {
22
+ return dynamicConfusionJsFiles.includes((0, utils_1.normalizePath)(filename));
23
+ }
24
+ exports.isConfusionFile = isConfusionFile;
25
+ function hasConfusionFile(inputDir) {
26
+ var _a, _b;
27
+ if (inputDir) {
28
+ const manifestJson = (0, manifest_1.parseManifestJsonOnce)(inputDir);
29
+ const resources = (_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.confusion) === null || _b === void 0 ? void 0 : _b.resources;
30
+ if (resources && parseConfusion(resources)[1].length) {
31
+ return true;
32
+ }
12
33
  }
13
- const resources = manifestJson.plus.confusion.resources;
14
- manifestJson.plus.confusion.resources = Object.keys(resources).reduce((res, name) => {
34
+ return !!dynamicConfusionJsFiles.length;
35
+ }
36
+ exports.hasConfusionFile = hasConfusionFile;
37
+ function parseConfusion(resources) {
38
+ const res = {};
39
+ const dynamicJsFiles = [];
40
+ Object.keys(resources).reduce((res, name) => {
15
41
  const extname = path_1.default.extname(name);
16
42
  if (extname === '.nvue') {
17
43
  res[name.replace('.nvue', '.js')] = resources[name];
18
44
  }
19
- else if (extname === '.js') {
20
- // 仅指定目录的js允许加密
21
- if (name.indexOf('hybrid/html') === 0 ||
22
- name.indexOf('static/') === 0 ||
23
- name.indexOf('/static/') !== -1 // subpackages, uni_modules 中的 static 目录
24
- ) {
45
+ else if (isJsFile(name)) {
46
+ // 静态 js 加密
47
+ if (isStaticJsFile(name)) {
25
48
  res[name] = resources[name];
26
49
  }
50
+ else {
51
+ // 非静态 js 将被合并进 app-confusion.js
52
+ dynamicJsFiles.push(name);
53
+ }
27
54
  }
28
55
  else {
29
56
  throw new Error(`原生混淆仅支持 nvue 页面,错误的页面路径:${name}`);
30
57
  }
31
58
  // TODO 旧编译器会检查要加密的 nvue 页面(包括subnvue)是否被使用?后续有时间再考虑支持吧,意义不太大
32
59
  return res;
33
- }, {});
60
+ }, res);
61
+ if (dynamicJsFiles.length) {
62
+ res[exports.APP_CONFUSION_FILENAME] = {};
63
+ }
64
+ return [res, dynamicJsFiles];
65
+ }
66
+ function initConfusion(manifestJson) {
67
+ var _a;
68
+ dynamicConfusionJsFiles.length = 0;
69
+ if (!((_a = manifestJson.plus.confusion) === null || _a === void 0 ? void 0 : _a.resources)) {
70
+ return;
71
+ }
72
+ const resources = manifestJson.plus.confusion.resources;
73
+ const [res, dynamicJsFiles] = parseConfusion(resources);
74
+ manifestJson.plus.confusion.resources = res;
75
+ dynamicConfusionJsFiles.push(...dynamicJsFiles);
34
76
  }
35
77
  exports.initConfusion = initConfusion;
@@ -1,3 +1,3 @@
1
- export declare function getAppRenderer(manifestJson: Record<string, any>): "native" | "";
1
+ export declare function getAppRenderer(manifestJson: Record<string, any>): "" | "native";
2
2
  export declare function getAppCodeSpliting(manifestJson: Record<string, any>): boolean;
3
3
  export declare function getAppStyleIsolation(manifestJson: Record<string, any>): 'apply-shared' | 'isolated' | 'shared';
@@ -1,3 +1,4 @@
1
1
  export declare function normalizeAppManifestJson(userManifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): Record<string, any>;
2
2
  export * from './env';
3
+ export { APP_CONFUSION_FILENAME, isConfusionFile, hasConfusionFile, } from './confusion';
3
4
  export { getNVueCompiler, getNVueStyleCompiler, getNVueFlexDirection, } from './nvue';
@@ -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.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.normalizeAppManifestJson = void 0;
13
+ exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
14
14
  const merge_1 = require("./merge");
15
15
  const defaultManifestJson_1 = require("./defaultManifestJson");
16
16
  const statusbar_1 = require("./statusbar");
@@ -39,6 +39,10 @@ function normalizeAppManifestJson(userManifestJson, pagesJson) {
39
39
  }
40
40
  exports.normalizeAppManifestJson = normalizeAppManifestJson;
41
41
  __exportStar(require("./env"), exports);
42
+ var confusion_2 = require("./confusion");
43
+ Object.defineProperty(exports, "APP_CONFUSION_FILENAME", { enumerable: true, get: function () { return confusion_2.APP_CONFUSION_FILENAME; } });
44
+ Object.defineProperty(exports, "isConfusionFile", { enumerable: true, get: function () { return confusion_2.isConfusionFile; } });
45
+ Object.defineProperty(exports, "hasConfusionFile", { enumerable: true, get: function () { return confusion_2.hasConfusionFile; } });
42
46
  var nvue_2 = require("./nvue");
43
47
  Object.defineProperty(exports, "getNVueCompiler", { enumerable: true, get: function () { return nvue_2.getNVueCompiler; } });
44
48
  Object.defineProperty(exports, "getNVueStyleCompiler", { enumerable: true, get: function () { return nvue_2.getNVueStyleCompiler; } });
@@ -1,4 +1,5 @@
1
1
  import { ComponentJson, PageWindowOptions, UsingComponents } from './types';
2
+ export declare function isPageFile(file: string): boolean;
2
3
  export declare function hasJsonFile(filename: string): boolean;
3
4
  export declare function normalizeJsonFilename(filename: string): string;
4
5
  export declare function findChangedJsonFiles(): Map<string, string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = void 0;
3
+ exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.hasJsonFile = exports.isPageFile = void 0;
4
4
  const shared_1 = require("@vue/shared");
5
5
  const utils_1 = require("../../utils");
6
6
  let appJsonCache = {};
@@ -8,6 +8,10 @@ const jsonFilesCache = new Map();
8
8
  const jsonPagesCache = new Map();
9
9
  const jsonComponentsCache = new Map();
10
10
  const jsonUsingComponentsCache = new Map();
11
+ function isPageFile(file) {
12
+ return jsonPagesCache.has((0, utils_1.removeExt)(file));
13
+ }
14
+ exports.isPageFile = isPageFile;
11
15
  function hasJsonFile(filename) {
12
16
  return (filename === 'app' ||
13
17
  jsonPagesCache.has(filename) ||
@@ -20,16 +24,21 @@ function normalizeJsonFilename(filename) {
20
24
  exports.normalizeJsonFilename = normalizeJsonFilename;
21
25
  function findChangedJsonFiles() {
22
26
  const changedJsonFiles = new Map();
23
- function findChangedFile(name, json) {
27
+ function findChangedFile(filename, json) {
24
28
  const newJson = (0, shared_1.extend)({}, json);
25
29
  if (!newJson.usingComponents) {
26
30
  newJson.usingComponents = {};
27
31
  }
28
- (0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(name));
32
+ (0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(filename));
33
+ const usingComponents = newJson.usingComponents;
34
+ // 格式化为相对路径,这样作为分包也可以直接运行
35
+ Object.keys(usingComponents).forEach((name) => {
36
+ usingComponents[name] = (0, utils_1.relativeFile)(filename, usingComponents[name].slice(1));
37
+ });
29
38
  const jsonStr = JSON.stringify(newJson, null, 2);
30
- if (jsonFilesCache.get(name) !== jsonStr) {
31
- changedJsonFiles.set(name, jsonStr);
32
- jsonFilesCache.set(name, jsonStr);
39
+ if (jsonFilesCache.get(filename) !== jsonStr) {
40
+ changedJsonFiles.set(filename, jsonStr);
41
+ jsonFilesCache.set(filename, jsonStr);
33
42
  }
34
43
  }
35
44
  function findChangedFiles(jsonsCache) {
@@ -15,4 +15,5 @@ export declare const M: {
15
15
  'easycom.conflict': string;
16
16
  'mp.component.args[0]': string;
17
17
  'mp.component.args[1]': string;
18
+ 'mp.360.unsupported': string;
18
19
  };
@@ -18,4 +18,5 @@ exports.M = {
18
18
  'easycom.conflict': 'easycom组件冲突:',
19
19
  'mp.component.args[0]': '{0}的第一个参数必须为静态字符串',
20
20
  'mp.component.args[1]': '{0}需要两个参数',
21
+ 'mp.360.unsupported': 'vue3暂不支持360小程序',
21
22
  };
package/dist/mp/style.js CHANGED
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformScopedCss = void 0;
4
- const scopedRE = /\[(data-v-[a-f0-9]{8})\]/gi;
5
4
  function transformScopedCss(cssCode) {
6
- return cssCode.replace(scopedRE, (_, scopedId) => {
5
+ return cssCode.replace(/\[(data-v-[a-f0-9]{8})\]/gi, (_, scopedId) => {
7
6
  return '.' + scopedId;
8
7
  });
9
8
  }
package/dist/utils.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { SFCTemplateCompileOptions } from '@vue/compiler-sfc';
3
3
  import { ElementNode, RootNode, TemplateChildNode } from '@vue/compiler-core';
4
4
  export declare const isWindows: boolean;
5
5
  export declare function normalizePath(id: string): string;
6
+ export declare function relativeFile(from: string, to: string): string;
6
7
  export declare function checkElementNodeTag(node: RootNode | TemplateChildNode | null | undefined, tag: string): node is ElementNode;
7
8
  export declare const resolveMainPathOnce: (inputDir: string) => string;
8
9
  export declare function resolveComponentsLibPath(): string;
package/dist/utils.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.createUniVueTransformAssetUrls = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.resolveBuiltIn = exports.getBuiltInPaths = exports.resolveComponentsLibPath = exports.resolveMainPathOnce = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.hash = void 0;
6
+ exports.createUniVueTransformAssetUrls = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.resolveBuiltIn = exports.getBuiltInPaths = exports.resolveComponentsLibPath = exports.resolveMainPathOnce = exports.checkElementNodeTag = exports.relativeFile = exports.normalizePath = exports.isWindows = exports.hash = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -18,6 +18,10 @@ function normalizePath(id) {
18
18
  return exports.isWindows ? id.replace(/\\/g, '/') : id;
19
19
  }
20
20
  exports.normalizePath = normalizePath;
21
+ function relativeFile(from, to) {
22
+ return normalizePath(path_1.default.relative(path_1.default.dirname(from), to));
23
+ }
24
+ exports.relativeFile = relativeFile;
21
25
  function checkElementNodeTag(node, tag) {
22
26
  return !!node && node.type === 1 /* ELEMENT */ && node.tag === tag;
23
27
  }
@@ -39,18 +43,36 @@ function resolveComponentsLibPath() {
39
43
  exports.resolveComponentsLibPath = resolveComponentsLibPath;
40
44
  const ownerModules = ['@dcloudio/uni-app', '@dcloudio/vite-plugin-uni'];
41
45
  const paths = [];
46
+ function resolveNodeModulePath(modulePath) {
47
+ const nodeModulesPaths = [];
48
+ const nodeModulesPath = path_1.default.join(modulePath, 'node_modules');
49
+ if (fs_1.default.existsSync(nodeModulesPath)) {
50
+ nodeModulesPaths.push(nodeModulesPath);
51
+ }
52
+ const index = modulePath.lastIndexOf('node_modules');
53
+ if (index > -1) {
54
+ nodeModulesPaths.push(path_1.default.join(modulePath.substr(0, index), 'node_modules'));
55
+ }
56
+ return nodeModulesPaths;
57
+ }
42
58
  function initPaths() {
43
59
  const cliContext = process.env.UNI_CLI_CONTEXT;
44
60
  if (cliContext) {
45
61
  const pathSet = new Set();
46
62
  pathSet.add(path_1.default.join(cliContext, 'node_modules'));
47
63
  [`@dcloudio/uni-` + process.env.UNI_PLATFORM, ...ownerModules].forEach((ownerModule) => {
64
+ let pkgPath = '';
48
65
  try {
49
- pathSet.add(path_1.default.resolve(require.resolve(ownerModule + '/package.json', {
66
+ pkgPath = require.resolve(ownerModule + '/package.json', {
50
67
  paths: [cliContext],
51
- }), '../node_modules'));
68
+ });
52
69
  }
53
70
  catch (e) { }
71
+ if (pkgPath) {
72
+ resolveNodeModulePath(path_1.default.dirname(pkgPath)).forEach((nodeModulePath) => {
73
+ pathSet.add(nodeModulePath);
74
+ });
75
+ }
54
76
  });
55
77
  paths.push(...pathSet);
56
78
  (0, debug_1.default)('uni-paths')(paths);
@@ -16,8 +16,8 @@ interface UniVitePluginUniOptions {
16
16
  miniProgram?: {
17
17
  emitFile?: (emittedFile: EmittedAsset) => string;
18
18
  };
19
- isNativeTag: ParserOptions['isNativeTag'];
20
- isCustomElement: ParserOptions['isCustomElement'];
19
+ isNativeTag?: ParserOptions['isNativeTag'];
20
+ isCustomElement?: ParserOptions['isCustomElement'];
21
21
  directiveTransforms?: CompilerOptions['directiveTransforms'];
22
22
  nodeTransforms?: CompilerOptions['nodeTransforms'];
23
23
  };
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformPageHead = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const transformPageHead = (node, context) => {
6
- // 发现是page-meta下的page-meta-head,直接remove该节点
7
- (0, utils_1.checkElementNodeTag)(node, 'page-meta-head') &&
6
+ // 发现是page-meta下的head,直接remove该节点
7
+ (0, utils_1.checkElementNodeTag)(node, 'head') &&
8
8
  (0, utils_1.checkElementNodeTag)(context.parent, 'page-meta') &&
9
9
  context.removeNode(node);
10
10
  };
@@ -1,3 +1,2 @@
1
- import { CodegenContext, NodeTransform } from '@vue/compiler-core';
1
+ import { NodeTransform } from '@vue/compiler-core';
2
2
  export declare function createTransformTag(opts: Record<string, string>): NodeTransform;
3
- export declare const onContextCreated: (context: CodegenContext) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onContextCreated = exports.createTransformTag = void 0;
3
+ exports.createTransformTag = void 0;
4
4
  const ast_1 = require("../../vite/utils/ast");
5
5
  function createTransformTag(opts) {
6
6
  return function transformTag(node, context) {
@@ -13,33 +13,6 @@ function createTransformTag(opts) {
13
13
  return;
14
14
  }
15
15
  node.tag = newTag;
16
- // SSR 时,已被提前添加到 components 中
17
- if (context.ssr && context.components.has(oldTag)) {
18
- context.components.delete(oldTag);
19
- context.components.add(newTag);
20
- }
21
16
  };
22
17
  }
23
18
  exports.createTransformTag = createTransformTag;
24
- const easycoms = {
25
- _component_uni_match_media: '_component_match_media',
26
- _component_page_head_meta: '_component_head',
27
- };
28
- const easycomKeys = Object.keys(easycoms);
29
- const onContextCreated = (context) => {
30
- if (!context.ssr) {
31
- return;
32
- }
33
- // 替换生成的 easycom 变量名
34
- const push = context.push;
35
- context.push = (code, node) => {
36
- if (code.includes('_resolveComponent(')) {
37
- const name = easycomKeys.find((name) => code.includes(name));
38
- if (name) {
39
- code = code.replace(name, easycoms[name]);
40
- }
41
- }
42
- return push(code, node);
43
- };
44
- };
45
- exports.onContextCreated = onContextCreated;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3021220211105012",
3
+ "version": "3.0.0-alpha-3021320211116001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,16 +20,18 @@
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-3021220211105012",
24
- "@dcloudio/uni-shared": "3.0.0-alpha-3021220211105012",
23
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3021320211116001",
24
+ "@dcloudio/uni-shared": "3.0.0-alpha-3021320211116001",
25
25
  "@rollup/pluginutils": "^4.1.1",
26
- "@vue/compiler-core": "^3.2.21",
27
- "@vue/compiler-dom": "^3.2.21",
26
+ "@vue/compiler-core": "3.2.22",
27
+ "@vue/compiler-dom": "3.2.22",
28
+ "@vue/shared": "3.2.22",
29
+ "chalk": "^4.1.1",
28
30
  "chokidar": "^3.5.2",
29
31
  "compare-versions": "^3.6.0",
30
32
  "debug": "^4.3.2",
31
33
  "es-module-lexer": "^0.9.3",
32
- "esbuild": "^0.13.12",
34
+ "esbuild": "^0.13.2",
33
35
  "estree-walker": "^2.0.2",
34
36
  "fast-glob": "^3.2.7",
35
37
  "fs-extra": "^10.0.0",
@@ -37,6 +39,8 @@
37
39
  "jsonc-parser": "^3.0.0",
38
40
  "magic-string": "^0.25.7",
39
41
  "merge": "^2.1.1",
42
+ "mime": "^3.0.0",
43
+ "module-alias": "^2.2.2",
40
44
  "postcss-import": "^14.0.2",
41
45
  "postcss-load-config": "^3.1.0",
42
46
  "postcss-selector-parser": "^6.0.6",
@@ -46,10 +50,13 @@
46
50
  },
47
51
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
48
52
  "devDependencies": {
53
+ "@types/debug": "^4.1.7",
49
54
  "@types/hash-sum": "^1.0.0",
50
55
  "@types/less": "^3.0.3",
56
+ "@types/mime": "^2.0.3",
57
+ "@types/module-alias": "^2.0.1",
51
58
  "@types/stylus": "^0.48.36",
52
- "@vue/compiler-sfc": "^3.2.21",
53
- "postcss": "^8.3.11"
59
+ "@vue/compiler-sfc": "3.2.22",
60
+ "postcss": "^8.3.8"
54
61
  }
55
62
  }