amxxpack 1.0.2 → 1.1.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.
- package/lib/builder/builder.js +18 -6
- package/package.json +1 -1
package/lib/builder/builder.js
CHANGED
|
@@ -150,7 +150,11 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
150
150
|
var _this = this;
|
|
151
151
|
return __generator(this, function (_a) {
|
|
152
152
|
switch (_a.label) {
|
|
153
|
-
case 0:
|
|
153
|
+
case 0:
|
|
154
|
+
if (!this.config.input.assets) {
|
|
155
|
+
return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
return [4 /*yield*/, this.buildDir(this.config.input.assets, constants_1.ASSETS_PATH_PATTERN, function (filePath) { return _this.updateAsset(filePath); })];
|
|
154
158
|
case 1:
|
|
155
159
|
_a.sent();
|
|
156
160
|
return [2 /*return*/];
|
|
@@ -189,7 +193,11 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
189
193
|
var _this = this;
|
|
190
194
|
return __generator(this, function (_a) {
|
|
191
195
|
switch (_a.label) {
|
|
192
|
-
case 0:
|
|
196
|
+
case 0:
|
|
197
|
+
if (!this.config.input.assets) {
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
}
|
|
200
|
+
return [4 /*yield*/, this.watchDir(this.config.input.assets, constants_1.ASSETS_PATH_PATTERN, function (filePath) { return _this.updateAsset(filePath); })];
|
|
193
201
|
case 1:
|
|
194
202
|
_a.sent();
|
|
195
203
|
return [2 /*return*/];
|
|
@@ -218,6 +226,9 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
218
226
|
return __generator(this, function (_a) {
|
|
219
227
|
switch (_a.label) {
|
|
220
228
|
case 0:
|
|
229
|
+
if (!this.config.output.scripts) {
|
|
230
|
+
return [2 /*return*/];
|
|
231
|
+
}
|
|
221
232
|
srcPath = path_1.default.resolve(filePath);
|
|
222
233
|
destPath = path_1.default.join(this.config.output.scripts, path_1.default.parse(filePath).base);
|
|
223
234
|
return [4 /*yield*/, (0, mkdirp_1.default)(this.config.output.scripts)];
|
|
@@ -318,12 +329,13 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
318
329
|
case 2:
|
|
319
330
|
result = _a.sent();
|
|
320
331
|
result.output.messages.forEach(function (message) {
|
|
321
|
-
var startLine = message.startLine, type = message.type, code = message.code, text = message.text;
|
|
332
|
+
var startLine = message.startLine, type = message.type, code = message.code, text = message.text, filename = message.filename;
|
|
333
|
+
var relativeFilePath = path_1.default.relative(process.cwd(), filename);
|
|
322
334
|
if (type === amxxpc_1.AMXPCMessageType.Error || type === amxxpc_1.AMXPCMessageType.FatalError) {
|
|
323
|
-
logger_1.default.error("".concat((0, normalize_path_1.default)(
|
|
335
|
+
logger_1.default.error("".concat((0, normalize_path_1.default)(relativeFilePath), "(").concat(startLine, ")"), type, code, ':', text);
|
|
324
336
|
}
|
|
325
337
|
else if (type === amxxpc_1.AMXPCMessageType.Warning) {
|
|
326
|
-
logger_1.default.warn("".concat((0, normalize_path_1.default)(
|
|
338
|
+
logger_1.default.warn("".concat((0, normalize_path_1.default)(relativeFilePath), "(").concat(startLine, ")"), type, code, ':', text);
|
|
327
339
|
}
|
|
328
340
|
else if (type === amxxpc_1.AMXPCMessageType.Echo) {
|
|
329
341
|
logger_1.default.debug(text);
|
|
@@ -366,7 +378,7 @@ var AmxxBuilder = /** @class */ (function () {
|
|
|
366
378
|
var pathPattern, watcher, updateFn;
|
|
367
379
|
return __generator(this, function (_a) {
|
|
368
380
|
pathPattern = path_1.default.join(baseDir, pattern);
|
|
369
|
-
watcher = chokidar_1.default.watch(pathPattern, { ignoreInitial: true });
|
|
381
|
+
watcher = chokidar_1.default.watch(pathPattern, { ignoreInitial: true, interval: 300 });
|
|
370
382
|
updateFn = function (filePath) { return cb(filePath).catch(function (err) { return logger_1.default.error(err.message); }); };
|
|
371
383
|
watcher.on('add', updateFn);
|
|
372
384
|
watcher.on('change', updateFn);
|