@pi-r/gulp 0.9.4 → 0.10.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 (2) hide show
  1. package/index.js +8 -6
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -6,8 +6,9 @@ const which = require("which");
6
6
  const node_util_1 = require("node:util");
7
7
  const types_1 = require("@e-mc/types");
8
8
  const Task = require('@e-mc/task');
9
- const BIN_NPX = Task.sanitizeCmd(which.sync('npx', { nothrow: true }) || 'npx');
10
- const BIN_GULP = Task.sanitizeCmd(which.sync("gulp", { nothrow: true }) || '');
9
+ const kGulp = Symbol.for('gulp:constructor');
10
+ const BIN_NPX = (0, types_1.sanitizeCmd)(which.sync('npx', { nothrow: true }) || 'npx');
11
+ const BIN_GULP = (0, types_1.sanitizeCmd)(which.sync("gulp", { nothrow: true }) || '');
11
12
  const REGEXP_TIMESTAMP = /^\[\d+:\d+:\d+\]$/;
12
13
  async function executeTasks(instance, assets, preceding, host) {
13
14
  if (instance.aborted) {
@@ -29,8 +30,9 @@ async function executeTasks(instance, assets, preceding, host) {
29
30
  }
30
31
  });
31
32
  }
32
- const normalizePath = (value) => Task.PLATFORM_WIN32 ? '"' + value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"' : Task.sanitizeArgs(value);
33
+ const normalizePath = (value) => Task.PLATFORM_WIN32 ? '"' + value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"' : (0, types_1.sanitizeArgs)(value);
33
34
  class Gulp extends Task {
35
+ static [kGulp] = true;
34
36
  static async finalize(instance, assets) {
35
37
  return executeTasks(instance, assets, false, this);
36
38
  }
@@ -255,7 +257,7 @@ class Gulp extends Task {
255
257
  Promise.all(items.map(async (src) => fs.promises.copyFile(src, path.join(tempDir, path.basename(src)))))
256
258
  .then(() => {
257
259
  try {
258
- const args = [...Task.sanitizeArgs(tasks), ...opts, '--gulpfile', normalizePath(gulpfile), '--cwd', normalizePath(tempDir)];
260
+ const args = (0, types_1.sanitizeArgs)(tasks).concat(opts, ['--gulpfile', normalizePath(gulpfile), '--cwd', normalizePath(tempDir)]);
259
261
  if (!BIN_GULP) {
260
262
  args.unshift('gulp');
261
263
  }
@@ -330,7 +332,7 @@ class Gulp extends Task {
330
332
  writeError("Unknown", err, false, 4);
331
333
  });
332
334
  if (stdout) {
333
- stdout.setEncoding('utf-8').on('data', (value) => {
335
+ stdout.setEncoding('utf8').on('data', (value) => {
334
336
  if (broadcastId) {
335
337
  setMessage(types_1.STATUS_TYPE.INFO, value);
336
338
  }
@@ -338,7 +340,7 @@ class Gulp extends Task {
338
340
  });
339
341
  }
340
342
  if (stderr) {
341
- stderr.setEncoding('utf-8').on('data', (value) => {
343
+ stderr.setEncoding('utf8').on('data', (value) => {
342
344
  if (broadcastId) {
343
345
  setMessage(types_1.STATUS_TYPE.ERROR, value);
344
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/gulp",
3
- "version": "0.9.4",
3
+ "version": "0.10.0",
4
4
  "description": "Gulp task constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -19,8 +19,8 @@
19
19
  "license": "MIT",
20
20
  "homepage": "https://github.com/anpham6/pi-r#readme",
21
21
  "dependencies": {
22
- "@e-mc/task": "^0.11.5",
23
- "@e-mc/types": "^0.11.5",
22
+ "@e-mc/task": "^0.12.0",
23
+ "@e-mc/types": "^0.12.0",
24
24
  "gulp": "^5.0.0",
25
25
  "gulp-cli": "^3.0.0",
26
26
  "which": "^4.0.0"