xhs-mp-compiler-cli 2.0.0-beta.3 → 2.0.0

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.
Files changed (94) hide show
  1. package/dist/bin/xhs-mp-cli-build.js +48 -34
  2. package/dist/bin/xhs-mp-cli-dev.js +44 -44
  3. package/dist/bin/xhs-mp-cli.js +22 -12
  4. package/dist/compiler.d.ts +21 -28
  5. package/dist/compiler.js +327 -327
  6. package/dist/compilerImpl.d.ts +19 -0
  7. package/dist/compilerImpl.js +173 -0
  8. package/dist/config/constant.config.d.ts +24 -0
  9. package/dist/config/constant.config.js +82 -30
  10. package/dist/config/dir.config.js +23 -13
  11. package/dist/index.d.ts +9 -9
  12. package/dist/index.js +454 -408
  13. package/dist/packs/index.d.ts +4 -4
  14. package/dist/packs/index.js +38 -30
  15. package/dist/packs/mp-pack/index.js +38 -30
  16. package/dist/packs/webpack/dev-server/index.js +61 -50
  17. package/dist/packs/webpack/dev-server/lib/ensurePort.js +33 -23
  18. package/dist/packs/webpack/dev-server/lib/openBrowser.js +28 -18
  19. package/dist/packs/webpack/index.d.ts +1 -1
  20. package/dist/packs/webpack/index.js +99 -90
  21. package/dist/packs/webpack/webpack.d.ts +2 -1
  22. package/dist/packs/webpack/webpack.js +81 -63
  23. package/dist/presets/babel.d.ts +0 -1
  24. package/dist/presets/babel.js +64 -58
  25. package/dist/presets/common.js +42 -45
  26. package/dist/presets/configs/minigame/assets/assetsEntryPlugin.js +50 -40
  27. package/dist/presets/configs/minigame/assets/index.js +62 -52
  28. package/dist/presets/configs/minigame/service/index.js +49 -30
  29. package/dist/presets/configs/minigame/service/resolveLimitPlugin.js +33 -23
  30. package/dist/presets/configs/minigame/service/serviceChunkPlugin.d.ts +2 -2
  31. package/dist/presets/configs/minigame/service/serviceChunkPlugin.js +69 -60
  32. package/dist/presets/configs/minigame/service/serviceEntryPlugin.d.ts +3 -3
  33. package/dist/presets/configs/minigame/service/serviceEntryPlugin.js +39 -29
  34. package/dist/presets/configs/miniprogram/assets/assetsEntryPlugin.js +120 -113
  35. package/dist/presets/configs/miniprogram/assets/index.js +45 -43
  36. package/dist/presets/configs/miniprogram/render/component.js +51 -41
  37. package/dist/presets/configs/miniprogram/render/index.d.ts +2 -3
  38. package/dist/presets/configs/miniprogram/render/index.js +85 -68
  39. package/dist/presets/configs/miniprogram/render/render.js +53 -43
  40. package/dist/presets/configs/miniprogram/render/renderChunkPlugin.js +84 -49
  41. package/dist/presets/configs/miniprogram/render/sjsEntryPlugin.d.ts +15 -0
  42. package/dist/presets/configs/miniprogram/render/sjsEntryPlugin.js +164 -126
  43. package/dist/presets/configs/miniprogram/service/index.js +82 -65
  44. package/dist/presets/configs/miniprogram/service/resolveLimitPlugin.js +60 -50
  45. package/dist/presets/configs/miniprogram/service/serviceChunkPlugin.js +93 -55
  46. package/dist/presets/index.js +100 -90
  47. package/dist/presets/loaders/mg-entry-loader.js +32 -22
  48. package/dist/presets/loaders/mini-style-loader.js +79 -55
  49. package/dist/presets/loaders/mp-entry-loader.js +149 -140
  50. package/dist/presets/loaders/wxss-loader.js +73 -63
  51. package/dist/presets/plugins/InjectorPlugin.js +23 -13
  52. package/dist/presets/plugins/SourceMapDevToolPlugin.d.ts +1 -0
  53. package/dist/presets/plugins/SourceMapDevToolPlugin.js +23 -0
  54. package/dist/presets/prod.js +88 -78
  55. package/dist/sharedFs.d.ts +2 -0
  56. package/dist/sharedFs.js +24 -0
  57. package/dist/types/index.d.ts +11 -37
  58. package/dist/types/index.js +23 -13
  59. package/dist/utils/{apm/index.d.ts → apm.d.ts} +5 -3
  60. package/dist/utils/apm.js +245 -0
  61. package/dist/utils/cache.d.ts +28 -0
  62. package/dist/utils/cache.js +49 -0
  63. package/dist/utils/common.js +42 -32
  64. package/dist/utils/css.d.ts +1 -1
  65. package/dist/utils/css.js +43 -35
  66. package/dist/utils/depenedHelper.js +95 -85
  67. package/dist/utils/file.js +39 -29
  68. package/dist/utils/loader-utils.js +63 -53
  69. package/dist/utils/postcssRpx2Vw.js +43 -33
  70. package/dist/utils/project.d.ts +3 -2
  71. package/dist/utils/project.js +129 -119
  72. package/dist/utils/projectConfig.js +24 -15
  73. package/dist/utils/utils.js +51 -42
  74. package/dist/utils/workerPool.d.ts +29 -0
  75. package/dist/utils/workerPool.js +125 -0
  76. package/dist/utils/zip.js +239 -229
  77. package/package.json +33 -14
  78. package/dist/compilerCP.d.ts +0 -1
  79. package/dist/compilerCP.js +0 -175
  80. package/dist/presets/loaders/sjs-loader/index.d.ts +0 -12
  81. package/dist/presets/loaders/sjs-loader/index.js +0 -605
  82. package/dist/presets/loaders/sjs-loader/scope.d.ts +0 -36
  83. package/dist/presets/loaders/sjs-loader/scope.js +0 -122
  84. package/dist/presets/loaders/sjs-loader/tranform.d.ts +0 -2
  85. package/dist/presets/loaders/sjs-loader/tranform.js +0 -31
  86. package/dist/utils/apm/index.js +0 -198
  87. package/dist/utils/asyncWebpack.d.ts +0 -3
  88. package/dist/utils/asyncWebpack.js +0 -38
  89. package/dist/utils/const.d.ts +0 -27
  90. package/dist/utils/const.js +0 -47
  91. package/dist/utils/getSuffixName.d.ts +0 -3
  92. package/dist/utils/getSuffixName.js +0 -18
  93. package/dist/utils/tagTransformMap.d.ts +0 -36
  94. package/dist/utils/tagTransformMap.js +0 -39
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScopeManager = exports.Scope = exports.SPECIFY_VAR = void 0;
4
- exports.SPECIFY_VAR = ["getDate", "getRegExp", "console"];
5
- const IDENTIFIER_WHITE_LIST = [
6
- "Object", "Boolean", "Array", "String", "Number", "Date", "Map", "Set",
7
- "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "isNaN", "isFinite", "parseFloat", "parseInt",
8
- "Infinity", "NaN", "undefined",
9
- "setTimeout", "clearTimeout", "setInterval", "clearInterval",
10
- "JSON", "Math",
11
- // 模块化
12
- "module", "require", "exports",
13
- ...exports.SPECIFY_VAR
14
- ];
15
- // 变量作用域表
16
- class Scope {
17
- constructor() {
18
- // 当前作用域定义的变量
19
- this.defines = {};
20
- // 当前作用域使用的变量
21
- this.access = {};
22
- }
23
- toString() {
24
- return `defines: ${Object.keys(this.defines)} access: ${Object.keys(this.access)}`;
25
- }
26
- /**
27
- * @returns
28
- */
29
- anlysis() {
30
- // TODO 优化算法复杂度
31
- // 在自身作用域 以及 上级作用域寻找,找到顶层作用域时 则需要看 白名单是否含有
32
- for (const variable in this.access) {
33
- // 白名单也不包含此变量
34
- if (this.checkGlobal(variable) && !IDENTIFIER_WHITE_LIST.includes(variable)) {
35
- return { variable, span: this.access[variable] };
36
- }
37
- }
38
- return undefined;
39
- }
40
- // 检查是否是全局调用
41
- checkGlobal(key) {
42
- let scope = this;
43
- while (scope) {
44
- if (!scope.defines[key]) {
45
- scope = scope.parentScope;
46
- continue;
47
- }
48
- else {
49
- return false;
50
- }
51
- }
52
- return !scope;
53
- }
54
- setAccess(key, value) {
55
- this.access[key] = value;
56
- }
57
- setDefines(key, value) {
58
- this.defines[key] = value;
59
- }
60
- setParentScope(scope) {
61
- this.parentScope = scope;
62
- }
63
- }
64
- exports.Scope = Scope;
65
- class ScopeManager {
66
- constructor() {
67
- // 栈帧
68
- this._scopeStack = [];
69
- // 栈 深度遍历结果
70
- this._scopeTables = [];
71
- // 是否停止收集
72
- this._stop = false;
73
- }
74
- // 停止分析
75
- stop() {
76
- this._stop = true;
77
- }
78
- enterScope() {
79
- if (this._stop)
80
- return;
81
- this._scopeStack.push(new Scope());
82
- }
83
- exitScope() {
84
- if (this._stop)
85
- return;
86
- const scope = this._scopeStack.pop();
87
- if (scope) {
88
- this._scopeTables.push(scope);
89
- scope.setParentScope(this.getCurrentScope());
90
- }
91
- }
92
- getCurrentScope() {
93
- if (this._stop)
94
- return;
95
- return this._scopeStack[this._scopeStack.length - 1];
96
- }
97
- // 记录定义的值
98
- pushIdentifier(id) {
99
- var _a;
100
- if (this._stop)
101
- return;
102
- if (this.getCurrentScope()) {
103
- (_a = this.getCurrentScope()) === null || _a === void 0 ? void 0 : _a.setDefines(id.value, id.span);
104
- }
105
- }
106
- // 记录使用的值
107
- pushAccess(id) {
108
- if (this._stop)
109
- return;
110
- const current = this.getCurrentScope();
111
- if (current) {
112
- current === null || current === void 0 ? void 0 : current.setAccess(id.value, id.span);
113
- if (exports.SPECIFY_VAR.includes(id.value)) {
114
- id._xhsScope = current;
115
- }
116
- }
117
- }
118
- getDFSScope() {
119
- return this._scopeTables;
120
- }
121
- }
122
- exports.ScopeManager = ScopeManager;
@@ -1,2 +0,0 @@
1
- import type { JscTarget, Program } from '@swc/core';
2
- export declare const transform: (code: string, plugin?: ((m: Program) => Program) | undefined, target?: JscTarget, minify?: boolean) => import("@swc/core").Output;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transform = void 0;
4
- const core_1 = require("@swc/core");
5
- const transform = (code, plugin, target = 'esnext', minify = false) => (0, core_1.transformSync)(code, {
6
- swcrc: false,
7
- configFile: false,
8
- minify,
9
- sourceMaps: false,
10
- jsc: {
11
- preserveAllComments: true,
12
- target,
13
- // minify: false,
14
- externalHelpers: false,
15
- parser: {
16
- syntax: "ecmascript",
17
- jsx: false,
18
- dynamicImport: false,
19
- privateMethod: false,
20
- functionBind: false,
21
- classPrivateProperty: false,
22
- exportDefaultFrom: false,
23
- exportNamespaceFrom: false,
24
- decorators: false,
25
- decoratorsBeforeExport: false,
26
- importMeta: false,
27
- },
28
- },
29
- plugin,
30
- });
31
- exports.transform = transform;
@@ -1,198 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createReporter = void 0;
13
- const path_1 = __importDefault(require("path"));
14
- const xhs_mp_utils_1 = require("xhs-mp-utils");
15
- const fs_extra_1 = require("fs-extra");
16
- const pkg = require('../../../package.json');
17
- function debug(...data) {
18
- // return process.send?.(JSON.stringify({ method: 'debugger', data }))
19
- }
20
- const cacheMap = {};
21
- function onceByParams(target, key, descriptor) {
22
- const originalMethod = descriptor.value;
23
- descriptor.value = function (...args) {
24
- try {
25
- const argsStr = JSON.stringify(args);
26
- if (cacheMap[key + argsStr])
27
- return;
28
- cacheMap[key + argsStr] = true;
29
- debug(key, ...args);
30
- return originalMethod.apply(this, args);
31
- }
32
- catch (error) {
33
- console.error(`call ${key} error`, error.message);
34
- }
35
- };
36
- return descriptor;
37
- }
38
- // const APMKEY = 'test_cli_apm'
39
- const APMKEY = 'xhsmp_compiler_basic_ability';
40
- /**
41
- * 上报过程中,除去 WebComponent 因为标签种类有很多需要上报多次之外,其余的项目维度上均只上报一次
42
- */
43
- class Reporter {
44
- constructor(apm) {
45
- this.apm = apm;
46
- }
47
- reportThirdFramework(name) {
48
- var _a, _b;
49
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
50
- type: xhs_mp_utils_1.FeatureReporter.MODULE.thirdFramework,
51
- name,
52
- });
53
- }
54
- reportMlFeature(feature) {
55
- var _a, _b;
56
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
57
- type: xhs_mp_utils_1.FeatureReporter.MODULE.ml,
58
- name: feature
59
- });
60
- }
61
- reportMlWebComponent(value) {
62
- var _a, _b;
63
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
64
- type: xhs_mp_utils_1.FeatureReporter.MODULE.ml,
65
- name: xhs_mp_utils_1.FeatureReporter.ML.WebComponent,
66
- value,
67
- });
68
- }
69
- // 在reporter 创建阶段即可根据传入project信息进行上报
70
- reportJSONComponent(name) {
71
- var _a, _b;
72
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
73
- type: xhs_mp_utils_1.FeatureReporter.MODULE.componentJSON,
74
- name,
75
- });
76
- }
77
- reportStyleIsolation(value) {
78
- var _a, _b;
79
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
80
- type: xhs_mp_utils_1.FeatureReporter.MODULE.componentJSON,
81
- name: xhs_mp_utils_1.FeatureReporter.JSONComponent.styleIsolation,
82
- value,
83
- });
84
- }
85
- reportJSONApp(name) {
86
- var _a, _b;
87
- (_b = (_a = this.apm) === null || _a === void 0 ? void 0 : _a.report) === null || _b === void 0 ? void 0 : _b.call(_a, APMKEY, {
88
- type: xhs_mp_utils_1.FeatureReporter.MODULE.appJSON,
89
- name,
90
- });
91
- }
92
- }
93
- __decorate([
94
- onceByParams
95
- ], Reporter.prototype, "reportThirdFramework", null);
96
- __decorate([
97
- onceByParams
98
- ], Reporter.prototype, "reportMlFeature", null);
99
- __decorate([
100
- onceByParams
101
- ], Reporter.prototype, "reportMlWebComponent", null);
102
- __decorate([
103
- onceByParams
104
- ], Reporter.prototype, "reportJSONComponent", null);
105
- __decorate([
106
- onceByParams
107
- ], Reporter.prototype, "reportStyleIsolation", null);
108
- __decorate([
109
- onceByParams
110
- ], Reporter.prototype, "reportJSONApp", null);
111
- function isObject(t) {
112
- return t != null && typeof t === 'object';
113
- }
114
- function isEmpty(t) {
115
- if (Array.isArray(t)) {
116
- return t.length === 0;
117
- }
118
- if (isObject(t)) {
119
- return Object.keys(t).length === 0;
120
- }
121
- return true;
122
- }
123
- function createReporter(project, option) {
124
- var _a, _b, _c;
125
- try {
126
- const app_id = option === null || option === void 0 ? void 0 : option.upload_app_id;
127
- // 上传时有version
128
- const version = (_a = option === null || option === void 0 ? void 0 : option.pkgInfo) === null || _a === void 0 ? void 0 : _a.version;
129
- if (!app_id || !version) {
130
- return;
131
- }
132
- const apm = new xhs_mp_utils_1.APM(`mp-compiler-${pkg.version}`);
133
- (_b = apm === null || apm === void 0 ? void 0 : apm.setContext) === null || _b === void 0 ? void 0 : _b.call(apm, app_id, {
134
- app_id,
135
- app_name: app_id,
136
- third_name: app_id,
137
- page_key: '0',
138
- app_env: 0,
139
- app_type: 0,
140
- bundle_version: version,
141
- base_version: ((_c = project.projectJsonContent) === null || _c === void 0 ? void 0 : _c.libVersion) || ''
142
- });
143
- const reporter = new Reporter(apm);
144
- function reportJSON() {
145
- var _a, _b, _c, _d;
146
- // 分包
147
- if ((_a = project.getSubPackages()) === null || _a === void 0 ? void 0 : _a.length) {
148
- reporter.reportJSONApp(xhs_mp_utils_1.FeatureReporter.JSONApp.subPackages);
149
- }
150
- // tabbar
151
- if (!isEmpty((_b = project.appJSON) === null || _b === void 0 ? void 0 : _b.tabBar)) {
152
- reporter.reportJSONApp(xhs_mp_utils_1.FeatureReporter.JSONApp.tabBar);
153
- }
154
- // 按需注入
155
- if ((_c = project.appJSON) === null || _c === void 0 ? void 0 : _c.lazyCodeLoading) {
156
- reporter.reportJSONApp(xhs_mp_utils_1.FeatureReporter.JSONApp.lazyCodeLoading);
157
- }
158
- // 预载
159
- if (!isEmpty((_d = project.appJSON) === null || _d === void 0 ? void 0 : _d.preloadRule)) {
160
- reporter.reportJSONApp(xhs_mp_utils_1.FeatureReporter.JSONApp.preloadRule);
161
- }
162
- const componentsMap = project.getComponentsMap();
163
- if (!isEmpty(componentsMap)) {
164
- // debug(componentsMap)
165
- for (let key in componentsMap) {
166
- const style = componentsMap[key].styleIsolation;
167
- // 样式隔离类型
168
- if (style) {
169
- reporter.reportStyleIsolation(style);
170
- }
171
- // 占位组件
172
- const componentPlaceholder = componentsMap[key].componentPlaceholder;
173
- if (!isEmpty(componentPlaceholder)) {
174
- reporter.reportJSONComponent(xhs_mp_utils_1.FeatureReporter.JSONComponent.componentPlaceholder);
175
- }
176
- }
177
- }
178
- }
179
- reportJSON();
180
- // 统计taro版本
181
- const vendor = path_1.default.join(project.miniprogramDir, 'vendors.js.LICENSE.txt');
182
- const taro = path_1.default.join(project.miniprogramDir, 'taro.js');
183
- if ((0, fs_extra_1.pathExistsSync)(taro) && (0, fs_extra_1.pathExistsSync)(vendor)) {
184
- const txt = (0, fs_extra_1.readFileSync)(vendor, { encoding: 'utf-8' });
185
- if (txt.includes('React') || txt.includes('react')) {
186
- reporter.reportThirdFramework(xhs_mp_utils_1.FeatureReporter.ThirdFramework.taroReact);
187
- }
188
- else if (txt.includes('@vue') || txt.includes('Vue')) {
189
- reporter.reportThirdFramework(xhs_mp_utils_1.FeatureReporter.ThirdFramework.taroVue);
190
- }
191
- }
192
- return reporter;
193
- }
194
- catch (error) {
195
- debug('[create reporter error]');
196
- }
197
- }
198
- exports.createReporter = createReporter;
@@ -1,3 +0,0 @@
1
- import { Configuration } from 'webpack';
2
- declare const webpackCompile: (config: Configuration[], callback?: () => void) => Promise<unknown>;
3
- export default webpackCompile;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const webpack_1 = __importDefault(require("webpack"));
16
- const webpackCompile = (config, callback) => __awaiter(void 0, void 0, void 0, function* () {
17
- return new Promise((res, rej) => {
18
- (0, webpack_1.default)(config, (err, stats) => {
19
- if (err) {
20
- // eslint-disable-next-line
21
- console.log(err);
22
- rej(err);
23
- }
24
- else {
25
- // eslint-disable-next-line
26
- console.log(stats === null || stats === void 0 ? void 0 : stats.toString({
27
- modules: true,
28
- chunks: true,
29
- children: false,
30
- colors: true,
31
- }));
32
- callback === null || callback === void 0 ? void 0 : callback();
33
- res(stats);
34
- }
35
- });
36
- });
37
- });
38
- exports.default = webpackCompile;
@@ -1,27 +0,0 @@
1
- declare const CONSTANTS: {
2
- PROD_BROWSERSLIST: string[];
3
- DEV_BROWSERSLIST: string[];
4
- DEV_TARGETS: {
5
- chrome: string;
6
- };
7
- PROD_TARGETS: {
8
- chrome: string;
9
- ios: string;
10
- };
11
- ENTRY_CSS_NAME: string;
12
- FULL_PKG: string;
13
- MAIN_PKG: string;
14
- SUB_PKG: string;
15
- BUILD_REASON: {
16
- INIT: string;
17
- FILE_CHANGE: string;
18
- ACTIVATE_PKG: string;
19
- RECOMPILE: string;
20
- };
21
- ASSETS_EXTS: string[];
22
- PACK_MODE: {
23
- MPPACK: string;
24
- WEBPACK: string;
25
- };
26
- };
27
- export default CONSTANTS;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const CONSTANTS = {
4
- PROD_BROWSERSLIST: ['ios_saf >= 10', 'chrome >= 83'],
5
- DEV_BROWSERSLIST: ['last 2 chrome version'],
6
- DEV_TARGETS: {
7
- chrome: '90',
8
- },
9
- PROD_TARGETS: {
10
- chrome: '83',
11
- ios: '10'
12
- },
13
- ENTRY_CSS_NAME: 'app',
14
- FULL_PKG: 'xhs-full',
15
- MAIN_PKG: 'xhs-main',
16
- SUB_PKG: 'xhs-sub',
17
- BUILD_REASON: {
18
- INIT: 'INIT',
19
- FILE_CHANGE: 'FILE_CHANGE',
20
- ACTIVATE_PKG: 'ACTIVATE_PKG',
21
- RECOMPILE: 'RECOMPILE',
22
- },
23
- ASSETS_EXTS: [
24
- 'png',
25
- 'jpg',
26
- 'jpeg',
27
- 'gif',
28
- 'svg',
29
- 'webp',
30
- 'cer',
31
- 'mp3',
32
- 'aac',
33
- 'm4a',
34
- 'mp4',
35
- 'wav',
36
- 'ogg',
37
- 'silk',
38
- 'wasm',
39
- 'br',
40
- 'plist',
41
- ],
42
- PACK_MODE: {
43
- MPPACK: 'mp-pack',
44
- WEBPACK: 'webpack'
45
- }
46
- };
47
- exports.default = CONSTANTS;
@@ -1,3 +0,0 @@
1
- export declare function getMlSuffixName(): string;
2
- export declare function getCssSuffixName(): "css" | "wxss";
3
- export declare function getPrefixName(): string | undefined;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPrefixName = exports.getCssSuffixName = exports.getMlSuffixName = void 0;
4
- function getMlSuffixName() {
5
- return `${process.env.__platform}ml`.trim();
6
- }
7
- exports.getMlSuffixName = getMlSuffixName;
8
- function getCssSuffixName() {
9
- if (process.env.__platform === 'xhs') {
10
- return 'css';
11
- }
12
- return 'wxss';
13
- }
14
- exports.getCssSuffixName = getCssSuffixName;
15
- function getPrefixName() {
16
- return process.env.__platform;
17
- }
18
- exports.getPrefixName = getPrefixName;
@@ -1,36 +0,0 @@
1
- declare const tagTransformMap: {
2
- view: string;
3
- text: string;
4
- image: string;
5
- input: string;
6
- icon: string;
7
- label: string;
8
- radio: string;
9
- 'radio-group': string;
10
- checkbox: string;
11
- 'checkbox-group': string;
12
- switch: string;
13
- textarea: string;
14
- button: string;
15
- swiper: string;
16
- 'swiper-item': string;
17
- navigator: string;
18
- slider: string;
19
- progress: string;
20
- 'rich-text': string;
21
- 'mf-page': string;
22
- 'scroll-view': string;
23
- picker: string;
24
- 'picker-view': string;
25
- 'picker-view-column': string;
26
- form: string;
27
- 'web-view': string;
28
- video: string;
29
- map: string;
30
- editor: string;
31
- 'movable-area': string;
32
- 'movable-view': string;
33
- canvas: string;
34
- camera: string;
35
- };
36
- export default tagTransformMap;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tagTransformMap = {
4
- view: 'xhs-vue-view',
5
- text: 'xhs-vue-text',
6
- // block: 'span',
7
- image: 'xhs-vue-image',
8
- input: 'xhs-vue-input',
9
- icon: 'xhs-vue-icon',
10
- label: 'xhs-vue-label',
11
- radio: 'xhs-vue-radio',
12
- 'radio-group': 'xhs-vue-radio-group',
13
- checkbox: 'xhs-vue-checkbox',
14
- 'checkbox-group': 'xhs-vue-checkbox-group',
15
- switch: 'xhs-vue-switch',
16
- textarea: 'xhs-vue-textarea',
17
- button: 'xhs-vue-button',
18
- swiper: 'xhs-vue-swiper',
19
- 'swiper-item': 'xhs-vue-swiper-item',
20
- navigator: 'xhs-vue-navigator',
21
- slider: 'xhs-vue-slider',
22
- progress: 'xhs-vue-progress',
23
- 'rich-text': 'xhs-vue-rich-text',
24
- 'mf-page': 'div',
25
- 'scroll-view': 'xhs-vue-scroll-view',
26
- picker: 'xhs-vue-picker',
27
- 'picker-view': 'xhs-vue-picker-view',
28
- 'picker-view-column': 'xhs-vue-picker-view-column',
29
- form: 'xhs-vue-form',
30
- 'web-view': 'xhs-vue-web-view',
31
- video: 'xhs-vue-video',
32
- map: 'xhs-vue-map',
33
- editor: 'xhs-vue-editor',
34
- 'movable-area': 'xhs-vue-movable-area',
35
- 'movable-view': 'xhs-vue-movable-view',
36
- canvas: 'xhs-vue-canvas',
37
- camera: 'xhs-vue-camera',
38
- };
39
- exports.default = tagTransformMap;