@ordewell/core 0.12.3 → 0.12.4
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/index.d.mts +6 -134
- package/dist/index.d.ts +6 -134
- package/dist/index.js +553 -414
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -400
- package/dist/index.mjs.map +1 -1
- package/dist/plan-utils.d.mts +1 -1
- package/dist/plan-utils.d.ts +1 -1
- package/dist/{runSettingsText-C6eto6Uv.d.ts → runSettingsText-BFaZSPRG.d.ts} +137 -1
- package/dist/{runSettingsText-DnzSrB0c.d.mts → runSettingsText-DWsmcnBq.d.mts} +137 -1
- package/dist/testing.d.mts +44 -1
- package/dist/testing.d.ts +44 -1
- package/dist/testing.js +66 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +50 -3
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/testing.ts
|
|
@@ -26,7 +36,12 @@ __export(testing_exports, {
|
|
|
26
36
|
FakeWorktreeIsolation: () => FakeWorktreeIsolation,
|
|
27
37
|
fakeConfig: () => fakeConfig,
|
|
28
38
|
fakeFileSystem: () => fakeFileSystem,
|
|
29
|
-
flushMicrotasks: () => flushMicrotasks
|
|
39
|
+
flushMicrotasks: () => flushMicrotasks,
|
|
40
|
+
homeEnv: () => homeEnv,
|
|
41
|
+
pathWithFake: () => pathWithFake,
|
|
42
|
+
removeDir: () => removeDir,
|
|
43
|
+
setEnv: () => setEnv,
|
|
44
|
+
writeStandIn: () => writeStandIn
|
|
30
45
|
});
|
|
31
46
|
module.exports = __toCommonJS(testing_exports);
|
|
32
47
|
|
|
@@ -95,6 +110,48 @@ function isWithin(node, ancestor) {
|
|
|
95
110
|
return node === ancestor || node.startsWith(`${ancestor}/`);
|
|
96
111
|
}
|
|
97
112
|
|
|
113
|
+
// src/testEnv.ts
|
|
114
|
+
var fs = __toESM(require("fs"));
|
|
115
|
+
var path = __toESM(require("path"));
|
|
116
|
+
function removeDir(dir) {
|
|
117
|
+
return fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
118
|
+
}
|
|
119
|
+
function homeEnv(home, platform = process.platform) {
|
|
120
|
+
if (platform !== "win32") return { HOME: home };
|
|
121
|
+
return {
|
|
122
|
+
HOME: home,
|
|
123
|
+
USERPROFILE: home,
|
|
124
|
+
APPDATA: path.win32.join(home, "AppData", "Roaming"),
|
|
125
|
+
LOCALAPPDATA: path.win32.join(home, "AppData", "Local"),
|
|
126
|
+
ProgramData: path.win32.join(home, "ProgramData"),
|
|
127
|
+
SCOOP: void 0,
|
|
128
|
+
SCOOP_GLOBAL: void 0
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function setEnv(vars) {
|
|
132
|
+
const saved = Object.fromEntries(Object.keys(vars).map((key) => [key, process.env[key]]));
|
|
133
|
+
applyEnv(vars);
|
|
134
|
+
return () => applyEnv(saved);
|
|
135
|
+
}
|
|
136
|
+
function applyEnv(vars) {
|
|
137
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
138
|
+
if (value === void 0) delete process.env[key];
|
|
139
|
+
else process.env[key] = value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function writeStandIn(bin, name) {
|
|
143
|
+
const file = path.join(bin, process.platform === "win32" ? `${name}.exe` : name);
|
|
144
|
+
fs.writeFileSync(file, "#!/bin/sh\nexit 1\n");
|
|
145
|
+
fs.chmodSync(file, 493);
|
|
146
|
+
return file;
|
|
147
|
+
}
|
|
148
|
+
function pathWithFake(dir, command, PATH = process.env.PATH ?? "", platform = process.platform) {
|
|
149
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
150
|
+
const native = platform === "win32" ? [".exe", ".com"] : [];
|
|
151
|
+
const holdsNative = (entry) => native.some((ext) => fs.existsSync(paths.join(entry.replace(/^"|"$/g, ""), `${command}${ext}`)));
|
|
152
|
+
return [dir, ...PATH.split(paths.delimiter).filter((entry) => entry && !holdsNative(entry))].join(paths.delimiter);
|
|
153
|
+
}
|
|
154
|
+
|
|
98
155
|
// src/testing.ts
|
|
99
156
|
async function flushMicrotasks(rounds = 20) {
|
|
100
157
|
for (let i = 0; i < rounds; i += 1) await Promise.resolve();
|
|
@@ -375,9 +432,9 @@ var FakeEventStore = class {
|
|
|
375
432
|
if (this.failing) throw this.failing;
|
|
376
433
|
for (const event of events) this.events.push({ ...event, seq: this.events.length + 1 });
|
|
377
434
|
}
|
|
378
|
-
async *read(after,
|
|
435
|
+
async *read(after, path2) {
|
|
379
436
|
for (const event of [...this.events]) {
|
|
380
|
-
if (event.seq > after && (
|
|
437
|
+
if (event.seq > after && (path2 === void 0 || isWithin(event.node, path2))) yield event;
|
|
381
438
|
}
|
|
382
439
|
}
|
|
383
440
|
async close() {
|
|
@@ -780,6 +837,11 @@ var FakeWorktreeIsolation = class {
|
|
|
780
837
|
FakeWorktreeIsolation,
|
|
781
838
|
fakeConfig,
|
|
782
839
|
fakeFileSystem,
|
|
783
|
-
flushMicrotasks
|
|
840
|
+
flushMicrotasks,
|
|
841
|
+
homeEnv,
|
|
842
|
+
pathWithFake,
|
|
843
|
+
removeDir,
|
|
844
|
+
setEnv,
|
|
845
|
+
writeStandIn
|
|
784
846
|
});
|
|
785
847
|
//# sourceMappingURL=testing.js.map
|