@pi-r/gulp 0.8.2 → 0.9.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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright 2024 An Pham
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright 2024 An Pham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- ### @pi-r/gulp
2
-
3
- https://e-mc.readthedocs.io/en/latest/task
4
-
5
- ### LICENSE
6
-
7
- MIT
1
+ ### @pi-r/gulp
2
+
3
+ https://e-mc.readthedocs.io/en/latest/task
4
+
5
+ ### LICENSE
6
+
7
+ MIT
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const path = require("path");
3
- const fs = require("fs");
4
- const child_process = require("child_process");
5
- const stripansi = require("strip-ansi");
2
+ const path = require("node:path");
3
+ const fs = require("node:fs");
4
+ const child_process = require("node:child_process");
6
5
  const which = require("which");
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
9
  const BIN_NPX = Task.sanitizeCmd(which.sync('npx', { nothrow: true }) || 'npx');
@@ -159,7 +159,8 @@ class Gulp extends Task {
159
159
  }
160
160
  async series(tasks) {
161
161
  let added, deleted;
162
- for await (const output of this.queue(tasks)) {
162
+ for (const task of this.queue(tasks)) {
163
+ const output = await task;
163
164
  if (output) {
164
165
  if (output.added) {
165
166
  (added ||= []).push(...output.added);
@@ -195,7 +196,7 @@ class Gulp extends Task {
195
196
  this.writeFail([value, hint || (this.moduleName + ': ' + task)], err, { type, startTime });
196
197
  }
197
198
  if (hint !== false) {
198
- queueMicrotask(() => {
199
+ setImmediate(() => {
199
200
  Task.removeDir(tempDir);
200
201
  });
201
202
  callback();
@@ -260,7 +261,7 @@ class Gulp extends Task {
260
261
  }
261
262
  let out = '', timeStamp = '', message = '';
262
263
  const setMessage = (type, value) => {
263
- if (REGEXP_TIMESTAMP.test(stripansi(value = value.trim()))) {
264
+ if (REGEXP_TIMESTAMP.test((0, node_util_1.stripVTControlCharacters)(value = value.trim()))) {
264
265
  timeStamp = value + ' ';
265
266
  }
266
267
  else {
@@ -276,7 +277,7 @@ class Gulp extends Task {
276
277
  let added, deleted;
277
278
  try {
278
279
  const files = fs.readdirSync(tempDir);
279
- for (let i = 0, copy; i < files.length; ++i) {
280
+ for (let i = 0, copy = false; i < files.length; ++i) {
280
281
  const filename = files[i];
281
282
  try {
282
283
  const dest = path.join(origDir, filename);
@@ -316,7 +317,7 @@ class Gulp extends Task {
316
317
  (added ||= []).push(value);
317
318
  }
318
319
  }
319
- queueMicrotask(() => {
320
+ setImmediate(() => {
320
321
  Task.removeDir(tempDir);
321
322
  });
322
323
  callback({ added, deleted });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/gulp",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Gulp task constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -13,18 +13,16 @@
13
13
  },
14
14
  "keywords": [
15
15
  "squared",
16
- "e-mc",
17
- "squared-functions"
16
+ "e-mc"
18
17
  ],
19
18
  "author": "An Pham <anpham6@gmail.com>",
20
19
  "license": "MIT",
21
20
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
21
  "dependencies": {
23
- "@e-mc/task": "^0.10.2",
24
- "@e-mc/types": "^0.10.2",
22
+ "@e-mc/task": "^0.11.0",
23
+ "@e-mc/types": "^0.11.0",
25
24
  "gulp": "^5.0.0",
26
25
  "gulp-cli": "^3.0.0",
27
- "strip-ansi": "6.0.1",
28
- "which": "^2.0.2"
26
+ "which": "^4.0.0"
29
27
  }
30
28
  }
package/types/index.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- import type { IHost, ITask, TaskConstructor } from '@e-mc/types/lib';
2
- import type { ExecAction, TaskModule } from '@e-mc/types/lib/settings';
3
-
4
- export interface GulpCommand {
5
- path?: string;
6
- tasks?: ArrayOf<string>;
7
- opts?: ArrayOf<string>;
8
- }
9
-
10
- export interface GulpData extends GulpCommand {
11
- items: string[];
12
- }
13
-
14
- export interface GulpSettings extends PlainObject {
15
- exec?: ExecAction;
16
- users?: GulpUsers;
17
- }
18
-
19
- export type GulpTask = string | GulpCommand;
20
- export type GulpUsers = GulpTask | AnyObject;
21
-
22
- export interface GulpTaskConstructor<T extends IHost, U extends TaskModule = TaskModule<GulpSettings>> extends ConstructorDerived<TaskConstructor<T, U>> {
23
- readonly prototype: ITask<T, U>;
24
- new(module?: U, ...args: unknown[]): ITask<T, U>;
1
+ import type { IHost, ITask, TaskConstructor } from '@e-mc/types/lib';
2
+ import type { ExecAction, TaskModule } from '@e-mc/types/lib/settings';
3
+
4
+ export interface GulpCommand {
5
+ path?: string;
6
+ tasks?: string | string[];
7
+ opts?: string | string[];
8
+ }
9
+
10
+ export interface GulpData extends GulpCommand {
11
+ items: string[];
12
+ }
13
+
14
+ export interface GulpSettings extends PlainObject {
15
+ exec?: ExecAction;
16
+ users?: GulpUsers;
17
+ }
18
+
19
+ export type GulpTask = string | GulpCommand;
20
+ export type GulpUsers = GulpTask | AnyObject;
21
+
22
+ export interface GulpTaskConstructor<T extends IHost, U extends TaskModule = TaskModule<GulpSettings>> extends ConstructorDerived<TaskConstructor<T, U>> {
23
+ readonly prototype: ITask<T, U>;
24
+ new(module?: U, ...args: unknown[]): ITask<T, U>;
25
25
  }