@hyext/builder-revues 1.5.7-alpha.1 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -392,26 +392,31 @@ function watchProject(opts, done) {
392
392
  });
393
393
  }
394
394
 
395
- function compile(mode, projectPath, outputPath) {
395
+ function transformCompileOptions(mode, projectConfig) {
396
+ const userCompileSettings = projectConfig.setting;
397
+ const compileSettings = mode === 'prod' ? Object.assign({
398
+ minify: true,
399
+ autoPrefixWXSS: true,
400
+ minifyWXSS: true,
401
+ es6: true
402
+ }, userCompileSettings) : {};
403
+ const userBuildOption = projectConfig.buildOption || { compilerSource: 'wx' };
404
+ return {
405
+ compileSettings: compileSettings,
406
+ compilerSource: userBuildOption.compilerSource
407
+ };
408
+ }
409
+
410
+ function compile(mode, projectConfig, projectPath, outputPath) {
396
411
  return __awaiter(this, void 0, void 0, function* () {
397
412
  const isProd = mode === 'prod';
398
- const compileSettings = isProd ? {
399
- minify: true,
400
- autoPrefixWXSS: true,
401
- minifyWXSS: true,
402
- es6: true
403
- } : {};
413
+ const extraOpts = transformCompileOptions(mode, projectConfig);
404
414
  const { plugins, } = yield tryLoadPlugins(projectPath);
405
415
  initCacheDir();
406
416
  const run = (keep) => __awaiter(this, void 0, void 0, function* () {
407
- yield codeCompiler.compilerManager.init({
408
- projectPath,
409
- outputPath,
410
- cachePath: cacheDir,
411
- compileSettings,
412
- plugins,
413
- mode
414
- });
417
+ yield codeCompiler.compilerManager.init(Object.assign({ projectPath,
418
+ outputPath, cachePath: cacheDir, plugins,
419
+ mode }, extraOpts));
415
420
  const action = isProd ? 'compile' : 'compileDev';
416
421
  yield codeCompiler.compilerManager[action](isProd ? undefined : keep);
417
422
  });
@@ -475,8 +480,8 @@ function watchGame(opts) {
475
480
  }
476
481
  function watchMiniProgram(opts) {
477
482
  return __awaiter(this, void 0, void 0, function* () {
478
- const { projectPath, outputPath, cb } = opts;
479
- const run = yield compile('dev', projectPath, outputPath);
483
+ const { projectPath, outputPath, cb, projectConfig } = opts;
484
+ const run = yield compile('dev', projectConfig, projectPath, outputPath);
480
485
  watchProject({
481
486
  compilerManager: codeCompiler.compilerManager,
482
487
  graphId: 'miniprogram',
@@ -486,8 +491,8 @@ function watchMiniProgram(opts) {
486
491
  }
487
492
  function watchDevPlugin(opts) {
488
493
  return __awaiter(this, void 0, void 0, function* () {
489
- const { projectPath, outputPath, cb } = opts;
490
- yield compile('dev', projectPath, outputPath);
494
+ const { projectPath, outputPath, cb, projectConfig } = opts;
495
+ yield compile('dev', projectConfig, projectPath, outputPath);
491
496
  // 开发插件时,需要监听 miniprogramRoot 和 pluginRoot
492
497
  codeCompiler.compilerManager.watch({ graphId: 'miniprogram' }, (type, filePath) => __awaiter(this, void 0, void 0, function* () {
493
498
  yield codeCompiler.compilerManager.compileSingleCode({
@@ -738,7 +743,7 @@ function genEntrys(props) {
738
743
  });
739
744
  }
740
745
 
741
- const libVersion = "1.4.3-alpha.1" ;
746
+ const libVersion = "1.4.3" ;
742
747
  const libCdn = '//a.msstatic.com/huya/hd/h5/static-source/revue/lib';
743
748
 
744
749
  function getLibVersion(builderConfig) {
@@ -1380,7 +1385,7 @@ class RevueBuilder {
1380
1385
  yield compileDevPluginForProd(contextPath, outputPath);
1381
1386
  }
1382
1387
  else {
1383
- yield compile('prod', contextPath, outputPath);
1388
+ yield compile('prod', projectConfig, contextPath, outputPath);
1384
1389
  }
1385
1390
  if (compileType === 'plugin') {
1386
1391
  // 统一将插件构建产物放到文件夹根目录
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyext/builder-revues",
3
- "version": "1.5.7-alpha.1",
3
+ "version": "1.5.8",
4
4
  "description": "> TODO: description",
5
5
  "author": "loler",
6
6
  "homepage": "",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@hyext/preload": "^1.1.3",
28
- "@revues/cocos-web-adapter": "1.5.7-alpha.1",
29
- "@revues/code-compiler": "1.5.7-alpha.1",
30
- "@revues/web-sdk-core": "1.5.7-alpha.1",
28
+ "@revues/cocos-web-adapter": "1.5.8",
29
+ "@revues/code-compiler": "1.5.8",
30
+ "@revues/web-sdk-core": "1.5.8",
31
31
  "archiver": "^7.0.1",
32
32
  "axios": "^1.7.3",
33
33
  "chalk": "^2.4.2",
@@ -47,5 +47,5 @@
47
47
  "@types/ramda": "^0.29.11",
48
48
  "terser": "^5.31.0"
49
49
  },
50
- "gitHead": "fc93bc7a89ab95c0fa130d1798668043b9b87e1f"
50
+ "gitHead": "76f1e9d3c37c0694f8e11bf0a1c295be9da88f6d"
51
51
  }