@plugjs/plug 0.2.7 → 0.3.1
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/cli/plug.mjs +2 -2
- package/cli/tsrun.mjs +3 -3
- package/dist/fs.cjs +1 -1
- package/dist/index.cjs +8 -8
- package/dist/plugs/debug.mjs +18 -28
- package/dist/plugs/debug.mjs.map +1 -1
- package/dist/plugs/edit.mjs +13 -23
- package/dist/plugs/edit.mjs.map +1 -1
- package/dist/plugs/esbuild/fix-extensions.cjs +1 -1
- package/dist/plugs/rmf.mjs +14 -24
- package/dist/plugs/rmf.mjs.map +1 -1
- package/dist/utils/exec.cjs +2 -2
- package/dist/utils/match.cjs +1 -1
- package/package.json +5 -6
package/cli/plug.mjs
CHANGED
|
@@ -1155,7 +1155,7 @@ function parseCommandLine(args) {
|
|
|
1155
1155
|
help = !!value;
|
|
1156
1156
|
break;
|
|
1157
1157
|
case "version":
|
|
1158
|
-
console.log(`v${"0.
|
|
1158
|
+
console.log(`v${"0.3.1"}`);
|
|
1159
1159
|
process.exit(0);
|
|
1160
1160
|
break;
|
|
1161
1161
|
default:
|
|
@@ -1177,7 +1177,7 @@ function parseCommandLine(args) {
|
|
|
1177
1177
|
${$wht}-c --colors${$rst} Force colorful output (use "--no-colors" to force plain text)
|
|
1178
1178
|
${$wht}-l --list${$rst} Only list the tasks defined by the build, nothing more!
|
|
1179
1179
|
${$wht}-h --help${$rst} Help! You're reading it now!
|
|
1180
|
-
${$wht} --version${$rst} Version! This one: ${"0.
|
|
1180
|
+
${$wht} --version${$rst} Version! This one: ${"0.3.1"}!
|
|
1181
1181
|
|
|
1182
1182
|
${$blu}${$und}Properties:${$rst}
|
|
1183
1183
|
|
package/cli/tsrun.mjs
CHANGED
|
@@ -1077,7 +1077,7 @@ function help() {
|
|
|
1077
1077
|
${$blu}${$und}Options:${$rst}
|
|
1078
1078
|
|
|
1079
1079
|
${$wht}-h --help ${$rst} Help! You're reading it now!
|
|
1080
|
-
${$wht}-v --version ${$rst} Version! This one: ${"0.
|
|
1080
|
+
${$wht}-v --version ${$rst} Version! This one: ${"0.3.1"}!
|
|
1081
1081
|
${$wht}-e --eval ${$rst} Evaluate the script
|
|
1082
1082
|
${$wht}-p --print ${$rst} Evaluate the script and print the result
|
|
1083
1083
|
${$wht} --force-esm${$rst} Force transpilation of ".ts" files to EcmaScript modules
|
|
@@ -1120,7 +1120,7 @@ main((args) => {
|
|
|
1120
1120
|
help();
|
|
1121
1121
|
break;
|
|
1122
1122
|
case "version":
|
|
1123
|
-
console.log(`v${"0.
|
|
1123
|
+
console.log(`v${"0.3.1"}`);
|
|
1124
1124
|
process.exit(0);
|
|
1125
1125
|
break;
|
|
1126
1126
|
case "eval":
|
|
@@ -1133,7 +1133,7 @@ main((args) => {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
1135
|
if (!_script) {
|
|
1136
|
-
console.log(`Welcome to Node.js ${process.version} (tsrun v${"0.
|
|
1136
|
+
console.log(`Welcome to Node.js ${process.version} (tsrun v${"0.3.1"}).`);
|
|
1137
1137
|
console.log('Type ".help" for more information.');
|
|
1138
1138
|
_repl.start();
|
|
1139
1139
|
} else if (_eval) {
|
package/dist/fs.cjs
CHANGED
|
@@ -62,7 +62,7 @@ __export(fs_exports, {
|
|
|
62
62
|
writeFile: () => writeFile
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(fs_exports);
|
|
65
|
-
var import_promises = __toESM(require("node:fs/promises"));
|
|
65
|
+
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
66
66
|
var import_node_fs = require("node:fs");
|
|
67
67
|
var fs = Object.entries(import_promises.default).reduce((fs2, [key, val]) => {
|
|
68
68
|
if (typeof val === "function") {
|
package/dist/index.cjs
CHANGED
|
@@ -59,14 +59,14 @@ __export(src_exports, {
|
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(src_exports);
|
|
61
61
|
var import_files = require("./files.cjs");
|
|
62
|
-
var asserts = __toESM(require("./asserts.cjs"));
|
|
63
|
-
var files = __toESM(require("./files.cjs"));
|
|
64
|
-
var fork = __toESM(require("./fork.cjs"));
|
|
65
|
-
var fs = __toESM(require("./fs.cjs"));
|
|
66
|
-
var logging = __toESM(require("./logging.cjs"));
|
|
67
|
-
var paths = __toESM(require("./paths.cjs"));
|
|
68
|
-
var pipe = __toESM(require("./pipe.cjs"));
|
|
69
|
-
var utils = __toESM(require("./utils.cjs"));
|
|
62
|
+
var asserts = __toESM(require("./asserts.cjs"), 1);
|
|
63
|
+
var files = __toESM(require("./files.cjs"), 1);
|
|
64
|
+
var fork = __toESM(require("./fork.cjs"), 1);
|
|
65
|
+
var fs = __toESM(require("./fs.cjs"), 1);
|
|
66
|
+
var logging = __toESM(require("./logging.cjs"), 1);
|
|
67
|
+
var paths = __toESM(require("./paths.cjs"), 1);
|
|
68
|
+
var pipe = __toESM(require("./pipe.cjs"), 1);
|
|
69
|
+
var utils = __toESM(require("./utils.cjs"), 1);
|
|
70
70
|
var import_logging = require("./logging.cjs");
|
|
71
71
|
var import_asserts = require("./asserts.cjs");
|
|
72
72
|
__reExport(src_exports, require("./build.cjs"), module.exports);
|
package/dist/plugs/debug.mjs
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
1
|
// plugs/debug.ts
|
|
7
2
|
import { $gry, $p, $und, $ylw } from "../logging.mjs";
|
|
8
3
|
import { install } from "../pipe.mjs";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return files;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
4
|
+
install("debug", class Debug {
|
|
5
|
+
_title;
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
const [title = "Debugging"] = args;
|
|
8
|
+
this._title = title;
|
|
9
|
+
}
|
|
10
|
+
async pipe(files, context) {
|
|
11
|
+
context.log.notice(this._title, `${$gry("(")}${$ylw(files.length)} ${$gry("files)")}`);
|
|
12
|
+
context.log.notice("- base dir:", $p(context.resolve("@")));
|
|
13
|
+
context.log.notice("- build file dir:", $p(context.resolve(".")));
|
|
14
|
+
context.log.notice("- files dir:", $p(files.directory));
|
|
15
|
+
if (files.length) {
|
|
16
|
+
const [path, ...paths] = files;
|
|
17
|
+
context.log.notice("- relative paths:", $und($gry(path)));
|
|
18
|
+
for (const p of paths)
|
|
19
|
+
context.log.notice("- :", $und($gry(p)));
|
|
20
|
+
}
|
|
21
|
+
return files;
|
|
31
22
|
}
|
|
32
23
|
});
|
|
33
|
-
export default require_debug();
|
|
34
24
|
//# sourceMappingURL=debug.mjs.map
|
package/dist/plugs/debug.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/debug.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";AAAA,SAAS,MAAM,IAAI,MAAM,YAAY;AACrC,SAAS,eAAe;AAiBxB,QAAQ,SAAS,MAAM,MAA6B;AAAA,EACjC;AAAA,EAEjB,eAAe,MAA+B;AAC5C,UAAM,CAAE,QAAQ,WAAY,IAAI;AAChC,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,KAAK,OAAc,SAAkC;AACzD,YAAQ,IAAI,OAAO,KAAK,QAAQ,GAAG,KAAK,GAAG,IAAI,KAAK,MAAM,MAAM,KAAK,KAAK,QAAQ,GAAG;AACrF,YAAQ,IAAI,OAAO,sBAAsB,GAAG,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjE,YAAQ,IAAI,OAAO,sBAAsB,GAAG,QAAQ,QAAQ,GAAG,CAAC,CAAC;AACjE,YAAQ,IAAI,OAAO,sBAAsB,GAAG,MAAM,SAAS,CAAC;AAC5D,QAAI,MAAM,QAAQ;AAChB,YAAM,CAAE,MAAM,GAAG,KAAM,IAAI;AAC3B,cAAQ,IAAI,OAAO,sBAAsB,KAAK,KAAK,IAAI,CAAC,CAAC;AACzD,iBAAW,KAAK;AAAO,gBAAQ,IAAI,OAAO,sBAAsB,KAAK,KAAK,CAAC,CAAC,CAAC;AAAA,IAC/E;AACA,WAAO;AAAA,EACT;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/plugs/edit.mjs
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
1
|
// plugs/edit.ts
|
|
7
2
|
import { readFile, writeFile } from "../fs.mjs";
|
|
8
3
|
import { install } from "../pipe.mjs";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return files;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
4
|
+
install("edit", class Edit {
|
|
5
|
+
_callback;
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
this._callback = args[0];
|
|
8
|
+
}
|
|
9
|
+
async pipe(files) {
|
|
10
|
+
for (const file of files.absolutePaths()) {
|
|
11
|
+
const data = await readFile(file, "utf-8");
|
|
12
|
+
const edited = await this._callback(data, file);
|
|
13
|
+
if (edited !== void 0)
|
|
14
|
+
await writeFile(file, edited, "utf-8");
|
|
15
|
+
}
|
|
16
|
+
return files;
|
|
26
17
|
}
|
|
27
18
|
});
|
|
28
|
-
export default require_edit();
|
|
29
19
|
//# sourceMappingURL=edit.mjs.map
|
package/dist/plugs/edit.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/edit.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";AAAA,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AAkBxB,QAAQ,QAAQ,MAAM,KAA4B;AAAA,EAC/B;AAAA,EAEjB,eAAe,MAA8B;AAC3C,SAAK,YAAY,KAAK,CAAC;AAAA,EACzB;AAAA,EAEA,MAAM,KAAK,OAA8B;AACvC,eAAW,QAAQ,MAAM,cAAc,GAAG;AACxC,YAAM,OAAO,MAAM,SAAS,MAAM,OAAO;AACzC,YAAM,SAAS,MAAM,KAAK,UAAU,MAAM,IAAI;AAC9C,UAAI,WAAW;AAAW,cAAM,UAAU,MAAM,QAAQ,OAAO;AAAA,IACjE;AACA,WAAO;AAAA,EACT;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -33,7 +33,7 @@ __export(fix_extensions_exports, {
|
|
|
33
33
|
fixExtensions: () => fixExtensions
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(fix_extensions_exports);
|
|
36
|
-
var import_node_path = __toESM(require("node:path"));
|
|
36
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
37
37
|
var import_fs = require("../../fs.cjs");
|
|
38
38
|
var import_paths = require("../../paths.cjs");
|
|
39
39
|
function fixExtensions() {
|
package/dist/plugs/rmf.mjs
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
1
|
// plugs/rmf.ts
|
|
7
2
|
import { rm } from "../fs.mjs";
|
|
8
3
|
import { $gry, $p } from "../logging.mjs";
|
|
9
4
|
import { install } from "../pipe.mjs";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
install("rmf", class Rmf {
|
|
6
|
+
_dryRun;
|
|
7
|
+
constructor(dryRun) {
|
|
8
|
+
this._dryRun = !!dryRun;
|
|
9
|
+
}
|
|
10
|
+
async pipe(files, context) {
|
|
11
|
+
if (this._dryRun) {
|
|
12
|
+
for (const file of files.absolutePaths()) {
|
|
13
|
+
context.log.notice("Not removing file", $p(file), $gry("(dry-run)"));
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
for (const file of files.absolutePaths()) {
|
|
24
|
-
context.log.notice("Removing file", $p(file));
|
|
25
|
-
await rm(file);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
15
|
+
} else {
|
|
16
|
+
for (const file of files.absolutePaths()) {
|
|
17
|
+
context.log.notice("Removing file", $p(file));
|
|
18
|
+
await rm(file);
|
|
28
19
|
}
|
|
29
|
-
}
|
|
20
|
+
}
|
|
30
21
|
}
|
|
31
22
|
});
|
|
32
|
-
export default require_rmf();
|
|
33
23
|
//# sourceMappingURL=rmf.mjs.map
|
package/dist/plugs/rmf.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugs/rmf.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,MAAM,UAAU;AACzB,SAAS,eAAe;AAiBxB,QAAQ,OAAO,MAAM,IAA0B;AAAA,EAC5B;AAAA,EAGjB,YAAY,QAAkB;AAC5B,SAAK,UAAU,CAAC,CAAE;AAAA,EACpB;AAAA,EAEA,MAAM,KAAK,OAAc,SAAiC;AACxD,QAAI,KAAK,SAAS;AAChB,iBAAW,QAAQ,MAAM,cAAc,GAAG;AACxC,gBAAQ,IAAI,OAAO,qBAAqB,GAAG,IAAI,GAAG,KAAK,WAAW,CAAC;AAAA,MACrE;AAAA,IACF,OAAO;AACL,iBAAW,QAAQ,MAAM,cAAc,GAAG;AACxC,gBAAQ,IAAI,OAAO,iBAAiB,GAAG,IAAI,CAAC;AAC5C,cAAM,GAAG,IAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/utils/exec.cjs
CHANGED
|
@@ -33,8 +33,8 @@ __export(exec_exports, {
|
|
|
33
33
|
execChild: () => execChild
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(exec_exports);
|
|
36
|
-
var import_node_path = __toESM(require("node:path"));
|
|
37
|
-
var import_node_readline = __toESM(require("node:readline"));
|
|
36
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
37
|
+
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
38
38
|
var import_node_child_process = require("node:child_process");
|
|
39
39
|
var import_asserts = require("../asserts.cjs");
|
|
40
40
|
var import_logging = require("../logging.cjs");
|
package/dist/utils/match.cjs
CHANGED
|
@@ -33,7 +33,7 @@ __export(match_exports, {
|
|
|
33
33
|
match: () => match
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(match_exports);
|
|
36
|
-
var import_picomatch = __toESM(require("picomatch"));
|
|
36
|
+
var import_picomatch = __toESM(require("picomatch"), 1);
|
|
37
37
|
function match(globs, options = {}) {
|
|
38
38
|
return (0, import_picomatch.default)([...globs], {
|
|
39
39
|
basename: false,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plugjs/plug",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -105,13 +105,12 @@
|
|
|
105
105
|
"license": "Apache-2.0",
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"@types/node": "<19",
|
|
108
|
-
"
|
|
109
|
-
"picomatch": "^2.3.1"
|
|
110
|
-
"esbuild": "^0.17.11"
|
|
108
|
+
"esbuild": "^0.17.13",
|
|
109
|
+
"picomatch": "^2.3.1"
|
|
111
110
|
},
|
|
112
111
|
"devDependencies": {
|
|
113
|
-
"@types/yargs-parser": "^21.0.0",
|
|
114
112
|
"@types/picomatch": "^2.3.0",
|
|
113
|
+
"@types/yargs-parser": "^21.0.0",
|
|
115
114
|
"yargs-parser": "^21.1.1"
|
|
116
115
|
},
|
|
117
116
|
"files": [
|