@shijiu/jsview 2.0.1021 → 2.0.1073

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.
@@ -39471,6 +39471,12 @@ function normalizeHmrUrl(url) {
39471
39471
  if (!url.startsWith('.') && !url.startsWith('/')) {
39472
39472
  url = wrapId(url);
39473
39473
  }
39474
+ // JsView Added >>>
39475
+ // 解决@import的css文件没有被热更新问题。
39476
+ if (url.includes('type=style')) {
39477
+ url = url.substr(0, url.indexOf('?'))
39478
+ }
39479
+ // JsView Added <<<
39474
39480
  return url;
39475
39481
  }
39476
39482
  function error$1(pos) {
@@ -11,11 +11,10 @@ const jsviewConfig = defineConfig({
11
11
  assetsInlineLimit: 0,
12
12
  //cssTarget: 'css/', // 未生效
13
13
  commonjsOptions: {
14
- include: [
15
- /js-binary-schema-parser/,
16
- /gifuct-js/,
17
- /qr.js/
18
- ],
14
+ 'gifuct-js': true,
15
+ 'js-binary-schema-parser': true,
16
+ 'mockjs': true,
17
+ 'qr.js': true,
19
18
  },
20
19
  emptyOutDir: true,
21
20
  minify: true,
@@ -48,6 +47,7 @@ const jsviewConfig = defineConfig({
48
47
  optimizeDeps: {
49
48
  include: [
50
49
  'gifuct-js',
50
+ 'mockjs',
51
51
  'qr.js'
52
52
  ],
53
53
  exclude: [
@@ -6,7 +6,8 @@ import path from 'path';
6
6
  import {
7
7
  askAndAnswer,
8
8
  checkNodeVersion,
9
- parseArguments
9
+ parseArguments,
10
+ Logger,
10
11
  } from './jsview-common.mjs';
11
12
 
12
13
  function main(argv)
@@ -56,12 +57,10 @@ function main(argv)
56
57
  upgradeStagePixel(options);
57
58
  }
58
59
  } catch (ex) {
59
- console.error('JsView Error: Failed to update jsview source!');
60
- console.error(ex);
61
- process.exit(1);
60
+ Logger.ErrorAndExit("Failed to update jsview source!", ex);
62
61
  }
63
62
 
64
- console.error('JsView Info: Done!');
63
+ Logger.Info('Done!');
65
64
  }
66
65
 
67
66
  function getOptions(argv)
@@ -84,23 +83,22 @@ function getOptions(argv)
84
83
  const defaultUpgradeDir = 'src';
85
84
  options.upgradeDir = path.resolve(options.projectDir, argv.dir ?? defaultUpgradeDir);
86
85
  if (fs.existsSync(options.upgradeDir) == false) {
87
- console.error('JsView Error: Upgrade dir [' + options.upgradeDir + '] is not exists.');
88
- process.exit(1);
86
+ Logger.ErrorAndExit('Upgrade dir [' + options.upgradeDir + '] is not exists.');
89
87
  }
90
88
 
91
- console.info();
92
- console.info('Upgrade JsView source: ');
93
- console.info(' Project folder: ' + options.projectDir);
94
- console.info('=====================================');
95
- console.info(' Upgrade folder: ' + path.relative(options.projectDir, options.upgradeDir));
96
- console.info(' Stages: [ ' + options.stages.join(', ') + ' ]');
97
- console.info('=====================================');
89
+ Logger.Info();
90
+ Logger.Info('Upgrade JsView source: ');
91
+ Logger.Info(' Project folder: ' + options.projectDir);
92
+ Logger.Info('=====================================');
93
+ Logger.Info(' Upgrade folder: ' + path.relative(options.projectDir, options.upgradeDir));
94
+ Logger.Info(' Stages: [ ' + options.stages.join(', ') + ' ]');
95
+ Logger.Info('=====================================');
98
96
 
99
- console.info();
100
- console.info('Are you sure to upgrade it?');
97
+ Logger.Info();
98
+ Logger.Info('Are you sure to upgrade it?');
101
99
  const answer = askAndAnswer('(y/N) ');
102
100
  if (answer.substring(0, 1) != 'y' && answer.substring(0, 3) != 'yes') {
103
- console.error('JsView Info: User cancelled.')
101
+ Logger.Warn('User cancelled.')
104
102
  process.exit(1);
105
103
  }
106
104
 
@@ -112,13 +110,12 @@ function getOptions(argv)
112
110
  function upgradeStageAppConfig(options)
113
111
  {
114
112
  const msgPrefix = 'Stage ' + options.stageAppConfig;
115
- console.info(msgPrefix + ': Upgrading appConfig...');
113
+ Logger.Info(msgPrefix + ': Upgrading appConfig...');
116
114
 
117
115
 
118
116
  const appConfigDir = path.resolve(options.upgradeDir, 'appConfig');
119
117
  if (fs.existsSync(appConfigDir) == false) {
120
- console.error(msgPrefix + ': Failed to upgrading appConfig, appConfig folder is not found.');
121
- process.exit(1);
118
+ Logger.ErrorAndExit(msgPrefix + ': Failed to upgrading appConfig, appConfig folder is not found.');
122
119
  }
123
120
 
124
121
  const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
@@ -135,7 +132,7 @@ function upgradeStageAppConfig(options)
135
132
  function upgradeStageAlias(options)
136
133
  {
137
134
  const msgPrefix = 'Stage ' + options.stageAlias;
138
- console.info(msgPrefix + ': upgrading alias @ => /src ...');
135
+ Logger.Info(msgPrefix + ': upgrading alias @ => /src ...');
139
136
 
140
137
  const amendImportAlias = function(content) {
141
138
  if (isImportSyntax(content) == false) {
@@ -161,7 +158,7 @@ function upgradeStageAlias(options)
161
158
  function upgradeStageImportPostfix(options)
162
159
  {
163
160
  const msgPrefix = 'Stage ' + options.stageImportPostfix;
164
- console.info(msgPrefix + ': upgrading import postfix...');
161
+ Logger.Info(msgPrefix + ': upgrading import postfix...');
165
162
 
166
163
  const amendImportPostfix = function (content, sourceDir) {
167
164
  if (isImportSyntax(content) == false) {
@@ -206,7 +203,7 @@ function upgradeStageImportPostfix(options)
206
203
  function upgradeStageCommonJS(options)
207
204
  {
208
205
  const msgPrefix = 'Stage ' + options.stageCommonJS;
209
- console.info(msgPrefix + ': upgrading commonjs ...');
206
+ Logger.Info(msgPrefix + ': upgrading commonjs ...');
210
207
 
211
208
  const amendCommonJS = function(content) {
212
209
  let fixedContent = content;
@@ -236,7 +233,7 @@ function upgradeStageCommonJS(options)
236
233
  function upgradeStageHashHistory(options)
237
234
  {
238
235
  const msgPrefix = 'Stage ' + options.stageHashHistory;
239
- console.info(msgPrefix + ': Upgrading hash history...');
236
+ Logger.Info(msgPrefix + ': Upgrading hash history...');
240
237
 
241
238
  replaceStageContent(options, options.sourcePathList, msgPrefix,
242
239
  'createJsvHashHistory', 'jsvCreateHashHistory');
@@ -247,7 +244,7 @@ function upgradeStageHashHistory(options)
247
244
  function upgradeStageAnimation(options)
248
245
  {
249
246
  const msgPrefix = 'Stage ' + options.stageAnimation;
250
- console.info(msgPrefix + ': Upgrading animation...');
247
+ Logger.Info(msgPrefix + ': Upgrading animation...');
251
248
 
252
249
  const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
253
250
  ':onAnimationEnd', '@animationend');
@@ -257,7 +254,7 @@ function upgradeStageAnimation(options)
257
254
 
258
255
  function upgradeStagePixel(options) {
259
256
  const msgPrefix = 'Stage ' + options.stagePixels;
260
- console.info(msgPrefix + ': Upgrading pixels...');
257
+ Logger.Info(msgPrefix + ': Upgrading pixels...');
261
258
 
262
259
  // 过滤 (+ px), (+ 'px'), (+ "px"), (+ `px`), ( + ' px ') 等
263
260
  replaceStageContent(options, options.sourcePathList, msgPrefix,
@@ -306,7 +303,7 @@ function upgradeStagePixel(options) {
306
303
  function upgradeStageJsvAudio(options)
307
304
  {
308
305
  const msgPrefix = 'Stage ' + options.stageJsvAudio;
309
- console.info(msgPrefix + ': Upgrading jsv audio...');
306
+ Logger.Info(msgPrefix + ': Upgrading jsv audio...');
310
307
 
311
308
  const amendJsvAudio = function(content) {
312
309
  let fixedContent = content.replace('<audiotrack', '<jsv-audiotrack');
@@ -395,7 +392,7 @@ function replaceStageContent(options, sourcePathList, msgPrefix,
395
392
  }
396
393
 
397
394
  fs.writeFileSync(filePath, fixedContent, 'utf8');
398
- console.info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath));
395
+ Logger.Info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath));
399
396
  }
400
397
 
401
398
  return;
@@ -426,7 +423,7 @@ function renameStageFile(options, sourcePathList, msgPrefix,
426
423
  fs.writeFileSync(toFilePath, fixedContent, 'utf8');
427
424
  }
428
425
 
429
- console.info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath) + ' => ' + path.relative(options.projectDir, toFilePath));
426
+ Logger.Info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath) + ' => ' + path.relative(options.projectDir, toFilePath));
430
427
  }
431
428
 
432
429
  return;
@@ -479,7 +476,7 @@ function processSourceLineByLine(options, sourcePathList, msgPrefix, processor)
479
476
  }
480
477
 
481
478
  fs.writeFileSync(filePath, fixedContent, 'utf8');
482
- console.info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath));
479
+ Logger.Info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath));
483
480
  }
484
481
  }
485
482
 
@@ -4,6 +4,7 @@
4
4
  import childProcess from 'child_process';
5
5
  import fs from 'fs';
6
6
  import path from 'path';
7
+ import Logger from "./jsview-logger.js";
7
8
 
8
9
  function printArgumentsUsages(requiredUsages, optionalUsages, helpUsages)
9
10
  {
@@ -18,23 +19,23 @@ function printArgumentsUsages(requiredUsages, optionalUsages, helpUsages)
18
19
  maxLength = (maxLength > usage.length ? maxLength : usage.length);
19
20
  }
20
21
 
21
- console.log('Usages:');
22
+ Logger.Info('Usages:');
22
23
  for (const usage in requiredUsages) {
23
24
  const spaceLength = maxLength - usage.length;
24
- console.log();
25
- console.log(' ' + usage + ': ' + ' '.repeat(spaceLength) + '[Required] ' + requiredUsages[usage]);
25
+ Logger.Info();
26
+ Logger.Info(' ' + usage + ': ' + ' '.repeat(spaceLength) + '[Required] ' + requiredUsages[usage]);
26
27
  }
27
28
  for (const usage in optionalUsages) {
28
29
  const spaceLength = maxLength - usage.length;
29
- console.log();
30
- console.log(' ' + usage + ': ' + ' '.repeat(spaceLength) + '[Optional] ' + optionalUsages[usage]);
30
+ Logger.Info();
31
+ Logger.Info(' ' + usage + ': ' + ' '.repeat(spaceLength) + '[Optional] ' + optionalUsages[usage]);
31
32
  }
32
33
  for (const usage in helpUsages) {
33
34
  const spaceLength = maxLength - usage.length;
34
- console.log();
35
- console.log(' ' + usage + ': ' + ' '.repeat(spaceLength) + helpUsages[usage]);
35
+ Logger.Info();
36
+ Logger.Info(' ' + usage + ': ' + ' '.repeat(spaceLength) + helpUsages[usage]);
36
37
  }
37
- console.log();
38
+ Logger.Info();
38
39
  }
39
40
 
40
41
  function parseArguments(requiredUsages = {},
@@ -121,8 +122,7 @@ function parseArguments(requiredUsages = {},
121
122
  }
122
123
  if (key.startsWith('-') == false) {
123
124
  if (withoutUnparsed) {
124
- console.error('JsView Error: Failed to parse argument: ' + argu);
125
- process.exit(1);
125
+ Logger.ErrorAndExit('Failed to parse argument: ' + argu);
126
126
  } else {
127
127
  options.unparsed.push(key);
128
128
  continue;
@@ -132,8 +132,7 @@ function parseArguments(requiredUsages = {},
132
132
  if (hasKey(helpUsages, key) == false
133
133
  && hasKey(requiredUsages, key) == false
134
134
  && hasKey(optionalUsages, key) == false) {
135
- console.error('JsView Error: Failed to parse usage: ' + argu);
136
- process.exit(1);
135
+ Logger.ErrorAndExit('Failed to parse usage: ' + argu);
137
136
  }
138
137
 
139
138
  let formattedKey = formatKey(key);
@@ -151,8 +150,7 @@ function parseArguments(requiredUsages = {},
151
150
  for (const checker in requiredUsages) {
152
151
  const aliasedOptions = checkAliases(checker, options);
153
152
  if (!aliasedOptions) {
154
- console.log('JsView Error: Failed to find required option: ' + checker);
155
- process.exit(-1);
153
+ Logger.ErrorAndExit('Failed to find required option: ' + checker);
156
154
  }
157
155
  options = { ...options, ...aliasedOptions };
158
156
  }
@@ -227,8 +225,7 @@ function getPackageObject(modulePath)
227
225
  {
228
226
  const pkgFullFile = path.resolve(modulePath, 'package.json');
229
227
  if (!fs.existsSync(pkgFullFile)) {
230
- console.error('JsView Error: Failed to get ' + modulePath + ', file is not exists.');
231
- process.exit(1);
228
+ Logger.ErrorAndExit('Failed to get ' + modulePath + ', file is not exists.');
232
229
  }
233
230
  let pkgContent = fs.readFileSync(pkgFullFile, 'utf8');
234
231
  const pkgObj = JSON.parse(pkgContent);
@@ -260,7 +257,7 @@ function cpSync(workDir, srcPath, destPath, ignore=[])
260
257
  return;
261
258
  }
262
259
  const desc = ' ' + path.relative(workDir, srcPath) + ' -> ' + path.relative(workDir, destPath);
263
- console.info(desc);
260
+ Logger.Info(desc);
264
261
  fs.copyFileSync(srcPath, destPath);
265
262
  }
266
263
  }
@@ -268,7 +265,7 @@ function cpSync(workDir, srcPath, destPath, ignore=[])
268
265
  function rmSync(workDir, filePath)
269
266
  {
270
267
  const desc = ' -* ' + path.relative(workDir, filePath);
271
- console.info(desc);
268
+ Logger.Info(desc);
272
269
  fs.rmSync(filePath, { recursive: true, force: true });
273
270
  }
274
271
 
@@ -279,7 +276,7 @@ function symlinkSync(workDir, targetPath, toPath)
279
276
  const relativePath = path.relative(path.dirname(toPath), targetPath);
280
277
 
281
278
  const desc = ' ' + path.relative(workDir, toPath) + ' -< ' + path.relative(workDir, relativePath);
282
- console.info(desc);
279
+ Logger.Info(desc);
283
280
  fs.symlinkSync(relativePath, toPath, 'junction');
284
281
  }
285
282
 
@@ -292,7 +289,7 @@ function isSymlinkSync(filePath)
292
289
 
293
290
  function execCommand(cmdline, withOutput)
294
291
  {
295
- console.info('Run [' + cmdline + ']... ');
292
+ Logger.Info('Run [' + cmdline + ']... ');
296
293
  try {
297
294
  const ret = childProcess.execSync(cmdline, { stdio: withOutput ? 'pipe' : 'inherit' });
298
295
  if (ret) {
@@ -303,8 +300,7 @@ function execCommand(cmdline, withOutput)
303
300
  if (withOutput) {
304
301
  return err.stderr?.toString()
305
302
  } else {
306
- console.log(err)
307
- process.exit(err.status);
303
+ Logger.ErrorAndExit(err)
308
304
  }
309
305
  }
310
306
  }
@@ -314,10 +310,9 @@ function checkNodeVersion(minMajorVersion = 16)
314
310
  const versions = process.version.replace('v', '').split('.');
315
311
  const [majorVersion, minorVersion, patchVersion] = versions;
316
312
 
317
- console.log(`Node version: v${majorVersion}.${minorVersion}.${patchVersion}`);
313
+ Logger.Info(`Node version: v${majorVersion}.${minorVersion}.${patchVersion}`);
318
314
  if (majorVersion < minMajorVersion) {
319
- console.error('JsView Error: Node version is too low! Please upgrade your Node.js first.');
320
- process.exit(1);
315
+ Logger.ErrorAndExit('Node version is too low! Please upgrade your Node.js first.');
321
316
  }
322
317
  }
323
318
 
@@ -355,4 +350,5 @@ export {
355
350
  readJsonFile,
356
351
  rmSync,
357
352
  symlinkSync,
353
+ Logger,
358
354
  }
@@ -7,6 +7,9 @@ import os from 'os';
7
7
  import path from 'path';
8
8
  import url from 'url';
9
9
 
10
+ // 此文件打包在dist中,所以不能用Logger
11
+ // import { Logger } from './jsview-common.mjs';
12
+
10
13
  const context = {
11
14
  scriptDir: path.dirname(url.fileURLToPath(import.meta.url)),
12
15
  baseUrl: null,
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ class Logger {
6
+ static ErrorAndExit(...args) {
7
+ Logger.Error(...args);
8
+ process.exit(1);
9
+ }
10
+
11
+ static ErrorAndThrow(...args) {
12
+ Logger.Error(...args);
13
+ throw new Error();
14
+ }
15
+
16
+ static Error(...args) {
17
+ console.error();
18
+ console.error(Logger.Red("JsView Error:"), ...args, new Error());
19
+ }
20
+
21
+ static Warn(...args) {
22
+ console.error();
23
+ console.warn(Logger.Yellow("JsView Warning:"), ...args);
24
+ }
25
+
26
+ static Info(...args) {
27
+ console.info(Logger.Green("JsView Info:"), ...args);
28
+ }
29
+
30
+ static Debug(...args) {
31
+ const stack = new Error().stack;
32
+ const caller = stack.split("\n")[2].trim().split(" ")[1] + "()";
33
+ console.debug("JsView Debug:", caller, ...args);
34
+ }
35
+
36
+ static GetFileTag(filePath) {
37
+ const fileTag = Logger.Blue('[' + path.basename(filePath) + ']');
38
+ return fileTag;
39
+ }
40
+
41
+ static Red(log) {
42
+ return '\x1b[31m' + log + '\x1b[39m';
43
+ }
44
+
45
+ static Green(log) {
46
+ return '\x1b[32m' + log + '\x1b[39m';
47
+ }
48
+
49
+ static Yellow(log) {
50
+ return '\x1b[33m' + log + '\x1b[39m';
51
+ }
52
+
53
+ static Blue(log) {
54
+ return '\x1b[34m' + log + '\x1b[39m';
55
+ }
56
+ }
57
+
58
+ module.exports = Logger;
@@ -9,6 +9,7 @@ import {
9
9
  checkNodeVersion,
10
10
  getOptions,
11
11
  parseArguments,
12
+ Logger,
12
13
  } from './jsview-common.mjs';
13
14
 
14
15
  // npm run build 时检查jsview-dom是否处于Debug模式。
@@ -18,10 +19,7 @@ async function checkDomDebugDisabled(options) {
18
19
  const { getCodeDebugConfig } = await import(jsviewDomUrl);
19
20
  const domCodeDebug = getCodeDebugConfig();
20
21
  if (domCodeDebug.enableDebug !== false) {
21
- console.error();
22
- console.error('JsView Error: Dom code debug MUST be disabled, please check it in ' + jsviewDomFilePath);
23
- console.error();
24
- process.exit(1)
22
+ Logger.ErrorAndExit('Dom code debug MUST be disabled, please check it in ' + jsviewDomFilePath);
25
23
  }
26
24
  }
27
25
 
@@ -31,25 +29,21 @@ async function prepareMainAppData(options, fileMd5)
31
29
  // 加载私钥文件
32
30
  const privateKeyFile = path.resolve(options.appConfigDir, 'app_sign_private_key.crt');
33
31
  if (!fs.existsSync(privateKeyFile)) {
34
- console.error('JsView Error: Failed to open private key file from ' + privateKeyFile);
35
- process.exit(1);
32
+ Logger.ErrorAndExit('Failed to open private key file from ' + privateKeyFile);
36
33
  }
37
34
  const privateKeyText = fs.readFileSync(privateKeyFile);
38
35
  if (privateKeyText.indexOf('-----BEGIN PRIVATE KEY-----') < 0) {
39
- console.error('JsView Error: Get private from src/appConfig/app_sign_private_key.crt failed.');
40
- process.exit(1);
36
+ Logger.ErrorAndExit('Get private from src/appConfig/app_sign_private_key.crt failed.');
41
37
  }
42
38
 
43
39
  // 加载公钥文件
44
40
  const publicKeyFile = path.resolve(options.appConfigDir, 'app_sign_public_key.pem');
45
41
  if (!fs.existsSync(publicKeyFile)) {
46
- console.error('JsView Error: Failed to open public key file from ' + publicKeyFile);
47
- process.exit(1);
42
+ Logger.ErrorAndExit('Failed to open public key file from ' + publicKeyFile);
48
43
  }
49
44
  const publicKeyText = fs.readFileSync(publicKeyFile);
50
45
  if (publicKeyText.indexOf('-----BEGIN PUBLIC KEY-----') < 0) {
51
- console.error('JsView Error: Get private from src/appConfig/app_sign_public_key.pem failed.');
52
- process.exit(1);
46
+ Logger.ErrorAndExit('Get private from src/appConfig/app_sign_public_key.pem failed.');
53
47
  }
54
48
  // 公钥格式转化pem -> der,因为java中的解码处理只识别der格式
55
49
  let publicKeyDerText = publicKeyText.toString();
@@ -78,15 +72,13 @@ async function prepareMainAppData(options, fileMd5)
78
72
  Buffer.from(encryptCodeBase64, 'base64')
79
73
  ).toString();
80
74
  if (decryptCode !== fileMd5) {
81
- console.error('JsView Error: public key dismath to private key!');
82
- process.exit(1);
75
+ Logger.ErrorAndExit('public key dismath to private key!');
83
76
  }
84
77
 
85
78
  // 获取AppData信息
86
79
  const appConfigFilePath = path.resolve(options.appConfigDir, 'app.config.mjs');
87
80
  if (!fs.existsSync(appConfigFilePath)) {
88
- console.error('JsView Error: Failed to open app config file from ' + appConfigFilePath);
89
- process.exit(1);
81
+ Logger.ErrorAndExit('Failed to open app config file from ' + appConfigFilePath);
90
82
  }
91
83
  // const appConfigText = fs.readFileSync(appConfigFile);
92
84
  // const appDataOriginJson = JSON.parse(appConfigText);
@@ -111,7 +103,7 @@ async function signApp(options)
111
103
  }
112
104
 
113
105
  const filePath = path.resolve(options.distJsDir, fileName);
114
- // console.log(' -> ' + path.relative(options.projectDir, filePath));
106
+ // Logger.Info(' -> ' + path.relative(options.projectDir, filePath));
115
107
 
116
108
  var sourceContent = fs.readFileSync(filePath, 'utf8');
117
109
 
@@ -142,7 +134,7 @@ function redirectSourceMappingURL(options)
142
134
  }
143
135
 
144
136
  const filePath = path.resolve(options.distJsDir, fileName);
145
- // console.log(' -> ' + path.relative(options.projectDir, filePath));
137
+ // Logger.Info(' -> ' + path.relative(options.projectDir, filePath));
146
138
 
147
139
  let sourceContent = fs.readFileSync(filePath, 'utf8');
148
140
 
@@ -171,7 +163,7 @@ function makeMainJsvMjs(options, framework)
171
163
  };
172
164
 
173
165
  const to = jsEntryFilePath.replace(/.js$/, '.mjs');
174
- console.log(' -> ' + path.relative(options.projectDir, to));
166
+ Logger.Info(' -> ' + path.relative(options.projectDir, to));
175
167
  fs.copyFileSync(jsEntryFilePath, to);
176
168
  }
177
169
 
@@ -191,7 +183,7 @@ function makeDebugMap(options, framework)
191
183
 
192
184
  const from = path.resolve(options.distJsDir, fileName);
193
185
  const to = path.resolve(options.distDebugMapDir, fileName);
194
- // console.log(' -> ' + path.relative(options.projectDir, to));
186
+ // Logger.Info(' -> ' + path.relative(options.projectDir, to));
195
187
  fs.renameSync(from, to);
196
188
  };
197
189
 
@@ -201,19 +193,18 @@ function makeDebugMap(options, framework)
201
193
  extName = '.mjs'
202
194
  }
203
195
  const to = path.resolve(options.distJsDir, 'main.jsv' + extName);
204
- console.log(' -> ' + path.relative(options.projectDir, to));
196
+ Logger.Info(' -> ' + path.relative(options.projectDir, to));
205
197
  fs.copyFileSync(jsEntryFilePath, to);
206
198
  }
207
199
 
208
200
  const jsmapServeName = 'jsview-jsmap-serve.mjs';
209
201
  const jsmapServePath = path.resolve(options.jsviewToolsDir, jsmapServeName);
210
202
  if (!fs.existsSync(jsmapServePath)) {
211
- console.error('JsView Error: Failed to copy ' + jsmapServePath + ', file not exists.');
212
- process.exit(1);
203
+ Logger.ErrorAndExit('Failed to copy ' + jsmapServePath + ', file not exists.');
213
204
  }
214
205
 
215
206
  const to = path.resolve(options.distDebugDir, jsmapServeName);
216
- console.log(' -> ' + path.relative(options.projectDir, to));
207
+ Logger.Info(' -> ' + path.relative(options.projectDir, to));
217
208
  fs.copyFileSync(jsmapServePath, to);
218
209
  }
219
210
 
@@ -269,26 +260,28 @@ async function main(argv)
269
260
  }
270
261
  }
271
262
 
272
- console.info();
273
- console.info('Redirecting JsView source map...');
263
+ Logger.Info();
264
+ Logger.Info('Redirecting JsView source map...');
274
265
  redirectSourceMappingURL(options)
275
- console.info('Redirected JsView source map...');
266
+ Logger.Info('Redirected JsView source map...');
276
267
 
277
- console.info('Signing JsView App...');
268
+ Logger.Info('Signing JsView App...');
278
269
  await signApp(options);
279
- console.info('Signed JsView App.');
270
+ Logger.Info('Signed JsView App.');
280
271
 
281
- console.info('Making JsView main.jsv.mjs...');
272
+ Logger.Info('Making JsView main.jsv.mjs...');
282
273
  makeMainJsvMjs(options, argv.framework);
283
- console.info('Made JsView main.jsv.mjs...');
274
+ Logger.Info('Made JsView main.jsv.mjs...');
284
275
 
285
- console.info('Making JsView Debug map...');
276
+ Logger.Info('Making JsView Debug map...');
286
277
  makeDebugMap(options, argv.framework);
287
- console.info('Made JsView Debug map.');
278
+ Logger.Info('Made JsView Debug map.');
288
279
 
289
- console.info('Making JsView list...');
280
+ Logger.Info('Making JsView list...');
290
281
  makeJsvList(options);
291
- console.info('Made JsView list...');
282
+ Logger.Info('Made JsView list...');
283
+
284
+ Logger.Info('Done...');
292
285
  }
293
286
 
294
287
  const requiredUsages = {