@plugjs/plug 0.0.9 → 0.0.10
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/dist/run.cjs +7 -13
- package/dist/run.cjs.map +1 -1
- package/dist/run.mjs +9 -15
- package/dist/run.mjs.map +1 -1
- package/package.json +1 -1
- package/src/run.ts +12 -14
- package/types/run.d.ts +1 -1
package/dist/run.cjs
CHANGED
|
@@ -24,7 +24,6 @@ __export(run_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(run_exports);
|
|
26
26
|
var import_node_path = require("node:path");
|
|
27
|
-
var import_assert = require("./assert.cjs");
|
|
28
27
|
var import_files = require("./files.cjs");
|
|
29
28
|
var import_log = require("./log.cjs");
|
|
30
29
|
var import_paths = require("./paths.cjs");
|
|
@@ -48,19 +47,14 @@ var RunImpl = class {
|
|
|
48
47
|
report(title) {
|
|
49
48
|
return (0, import_log.createReport)(title, this.taskName);
|
|
50
49
|
}
|
|
51
|
-
resolve(...paths) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return this.buildDir;
|
|
55
|
-
if (path.startsWith("@")) {
|
|
56
|
-
const components = (0, import_node_path.normalize)(path.substring(1)).split(import_node_path.sep);
|
|
57
|
-
const relative = (0, import_node_path.join)(...components);
|
|
58
|
-
(0, import_assert.assert)(!(0, import_paths.isAbsolutePath)(relative), `Path "${path.substring(1)}" is absolute`);
|
|
59
|
-
return (0, import_paths.resolveAbsolutePath)(this.buildDir, relative);
|
|
50
|
+
resolve(path, ...paths) {
|
|
51
|
+
if (path && path.startsWith("@")) {
|
|
52
|
+
const components = path.substring(1).split(import_node_path.sep).filter((s) => !!s);
|
|
53
|
+
return (0, import_paths.resolveAbsolutePath)(this.buildDir, ...components, ...paths);
|
|
60
54
|
}
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
63
|
-
return (0, import_paths.resolveAbsolutePath)((0, import_paths.getCurrentWorkingDirectory)(), path);
|
|
55
|
+
if (!path)
|
|
56
|
+
return (0, import_paths.getCurrentWorkingDirectory)();
|
|
57
|
+
return (0, import_paths.resolveAbsolutePath)((0, import_paths.getCurrentWorkingDirectory)(), path, ...paths);
|
|
64
58
|
}
|
|
65
59
|
files(first, ...paths) {
|
|
66
60
|
if (typeof first === "string") {
|
package/dist/run.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/run.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAoB;AACpB,mBAAoC;AACpC,iBAAwF;AACxF,mBAA8E;AAC9E,kBAA+B;AAC/B,qBAA2C;AAC3C,kBAAkC;AAgF3B,IAAM,UAAN,MAA6B;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIT,YAAY,EAAE,UAAU,UAAU,WAAW,IAAI,GAA2B;AAC1E,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,SAAK,MAAM,WAAO,sBAAU,QAAQ;AAAA,EACtC;AAAA,EAGA,YAAY,OAA6B;AACvC,SAAK,IAAI,YAAQ,2BAAe,KAAK;AAAA,EACvC;AAAA,EAEA,OAAO,OAAuB;AAC5B,eAAO,yBAAa,OAAO,KAAK,QAAQ;AAAA,EAC1C;AAAA,EAEA,QAAQ,SAAkB,OAA+B;AAEvD,QAAI,QAAQ,KAAK,WAAW,GAAG,GAAG;AAEhC,YAAM,aAAa,KAAK,UAAU,CAAC,EAAE,MAAM,oBAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,iBAAO,kCAAoB,KAAK,UAAU,GAAG,YAAY,GAAG,KAAK;AAAA,IACnE;AAGA,QAAI,CAAE;AAAM,iBAAO,yCAA2B;AAG9C,eAAO,sCAAoB,yCAA2B,GAAG,MAAM,GAAG,KAAK;AAAA,EACzE;AAAA,EAIA,MAAM,UAAsC,OAA+B;AACzE,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO,mBAAM,QAAQ,KAAK,QAAQ,OAAO,GAAG,KAAK,CAAC;AAAA,IACpD,WAAW,OAAO;AAChB,aAAO,mBAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO;AACL,aAAO,mBAAM,QAAQ,KAAK,QAAQ,CAAC;AAAA,IACrC;AAAA,EACF;AAAA,EAEA,KAAK,SAAiB,MAAwD;AAC5E,UAAM,EAAE,QAAQ,SAAS,EAAE,cAAc,QAAQ,EAAE,QAAI,6BAAa,MAAM,CAAC,CAAC;AAE5E,UAAM,UAAU,QAAQ,QAAQ,EAAE,KAAK,YAAY;AACjD,YAAM,UAAU,KAAK,MAAM,aAAa,GAAG;AAC3C,uBAAiB,YAAQ,kBAAK,QAAQ,WAAW,CAAE,MAAM,GAAG,MAAO,GAAG,OAAO,GAAG;AAC9E,gBAAQ,UAAU,IAAI;AAAA,MACxB;AACA,aAAO,QAAQ,MAAM;AAAA,IACvB,CAAC;AAED,WAAO,KAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,KAAK,OAAsD;AACzD,WAAO,IAAI,qBAAS,OAAO,IAAI;AAAA,EACjC;AAAA,EAEA,KAAK,MAA0C;AAC7C,UAAM,IAAI,MAAM,wBAAwB,OAAO;AAAA,EACjD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/run.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// run.ts
|
|
2
|
-
import {
|
|
3
|
-
import { assert } from "./assert.mjs";
|
|
2
|
+
import { sep } from "node:path";
|
|
4
3
|
import { Files } from "./files.mjs";
|
|
5
4
|
import { createReport, getLevelNumber, getLogger } from "./log.mjs";
|
|
6
|
-
import { getCurrentWorkingDirectory,
|
|
5
|
+
import { getCurrentWorkingDirectory, resolveAbsolutePath } from "./paths.mjs";
|
|
7
6
|
import { PipeImpl } from "./pipe.mjs";
|
|
8
7
|
import { parseOptions } from "./utils/options.mjs";
|
|
9
8
|
import { walk } from "./utils/walk.mjs";
|
|
@@ -24,19 +23,14 @@ var RunImpl = class {
|
|
|
24
23
|
report(title) {
|
|
25
24
|
return createReport(title, this.taskName);
|
|
26
25
|
}
|
|
27
|
-
resolve(...paths) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return this.buildDir;
|
|
31
|
-
if (path.startsWith("@")) {
|
|
32
|
-
const components = normalize(path.substring(1)).split(sep);
|
|
33
|
-
const relative = join(...components);
|
|
34
|
-
assert(!isAbsolutePath(relative), `Path "${path.substring(1)}" is absolute`);
|
|
35
|
-
return resolveAbsolutePath(this.buildDir, relative);
|
|
26
|
+
resolve(path, ...paths) {
|
|
27
|
+
if (path && path.startsWith("@")) {
|
|
28
|
+
const components = path.substring(1).split(sep).filter((s) => !!s);
|
|
29
|
+
return resolveAbsolutePath(this.buildDir, ...components, ...paths);
|
|
36
30
|
}
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
39
|
-
return resolveAbsolutePath(getCurrentWorkingDirectory(), path);
|
|
31
|
+
if (!path)
|
|
32
|
+
return getCurrentWorkingDirectory();
|
|
33
|
+
return resolveAbsolutePath(getCurrentWorkingDirectory(), path, ...paths);
|
|
40
34
|
}
|
|
41
35
|
files(first, ...paths) {
|
|
42
36
|
if (typeof first === "string") {
|
package/dist/run.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/run.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,
|
|
4
|
+
"mappings": ";AAAA,SAAS,WAAW;AACpB,SAAS,aAA2B;AACpC,SAAS,cAAc,gBAAgB,iBAAiD;AACxF,SAAuB,4BAA4B,2BAA2B;AAC9E,SAAe,gBAAgB;AAC/B,SAAuB,oBAAoB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AG;AAC3C,uBAAiB,QAAQ,KAAK,QAAQ,WAAW,CAAE,MAAM,GAAG,MAAO,GAAG,OAAO,GAAG;AAC9E,gBAAQ,UAAU,IAAI;AAAA,MACxB;AACA,aAAO,QAAQ,MAAM;AAAA,IACvB,CAAC;AAED,WAAO,KAAK,KAAK,OAAO;AAAA,EAC1B;AAAA,EAEA,KAAK,OAAsD;AACzD,WAAO,IAAI,SAAS,OAAO,IAAI;AAAA,EACjC;AAAA,EAEA,KAAK,MAA0C;AAC7C,UAAM,IAAI,MAAM,wBAAwB,OAAO;AAAA,EACjD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
package/src/run.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assert } from './assert.js'
|
|
1
|
+
import { sep } from 'node:path'
|
|
3
2
|
import { Files, FilesBuilder } from './files.js'
|
|
4
3
|
import { createReport, getLevelNumber, getLogger, Logger, LogLevelString, Report } from './log.js'
|
|
5
|
-
import { AbsolutePath, getCurrentWorkingDirectory,
|
|
4
|
+
import { AbsolutePath, getCurrentWorkingDirectory, resolveAbsolutePath } from './paths.js'
|
|
6
5
|
import { Pipe, PipeImpl } from './pipe.js'
|
|
7
6
|
import { ParseOptions, parseOptions } from './utils/options.js'
|
|
8
7
|
import { walk, WalkOptions } from './utils/walk.js'
|
|
@@ -109,20 +108,19 @@ export class RunImpl implements Run {
|
|
|
109
108
|
return createReport(title, this.taskName)
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
resolve(...paths: string[]): AbsolutePath {
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const relative = join(...components) // this will remove any leading slash
|
|
119
|
-
assert(! isAbsolutePath(relative), `Path "${path.substring(1)}" is absolute`)
|
|
120
|
-
return resolveAbsolutePath(this.buildDir, relative)
|
|
111
|
+
resolve(path?: string, ...paths: string[]): AbsolutePath {
|
|
112
|
+
// Paths starting with "@" are relative to the build file directory
|
|
113
|
+
if (path && path.startsWith('@')) {
|
|
114
|
+
// We can have paths like "@/../foo/bar" or "@../foo/bar"... both are ok
|
|
115
|
+
const components = path.substring(1).split(sep).filter((s) => !!s)
|
|
116
|
+
return resolveAbsolutePath(this.buildDir, ...components, ...paths)
|
|
121
117
|
}
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
// No path? Resolve to the CWD!
|
|
120
|
+
if (! path) return getCurrentWorkingDirectory()
|
|
124
121
|
|
|
125
|
-
|
|
122
|
+
// For all the rest, normal resolution!
|
|
123
|
+
return resolveAbsolutePath(getCurrentWorkingDirectory(), path, ...paths)
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
files(files: Files): FilesBuilder
|
package/types/run.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export declare class RunImpl implements Run {
|
|
|
80
80
|
/** Set the logging level within this {@link Run} */
|
|
81
81
|
setLogLevel(level: LogLevelString): void;
|
|
82
82
|
report(title: string): Report;
|
|
83
|
-
resolve(...paths: string[]): AbsolutePath;
|
|
83
|
+
resolve(path?: string, ...paths: string[]): AbsolutePath;
|
|
84
84
|
files(files: Files): FilesBuilder;
|
|
85
85
|
files(...paths: string[]): FilesBuilder;
|
|
86
86
|
find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files>;
|