locter 0.3.2 → 0.5.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/dist/index.cjs.js +864 -0
- package/dist/index.esm.js +842 -0
- package/dist/{index.d.ts → types/index.d.ts} +0 -0
- package/dist/{loader → types/loader}/file-type/index.d.ts +0 -0
- package/dist/types/loader/file-type/json.d.ts +3 -0
- package/dist/{loader → types/loader}/file-type/script/async.d.ts +0 -0
- package/dist/{loader → types/loader}/file-type/script/index.d.ts +0 -0
- package/dist/{loader → types/loader}/file-type/script/sync.d.ts +0 -0
- package/dist/types/loader/file-type/script/type.d.ts +5 -0
- package/dist/{loader → types/loader}/file-type/script/utils.d.ts +0 -0
- package/dist/{loader → types/loader}/index.d.ts +0 -0
- package/dist/types/loader/module.d.ts +3 -0
- package/dist/types/loader/utils.d.ts +2 -0
- package/dist/{locator → types/locator}/async.d.ts +0 -0
- package/dist/{locator → types/locator}/index.d.ts +0 -0
- package/dist/{locator → types/locator}/sync.d.ts +0 -0
- package/dist/{locator → types/locator}/type.d.ts +2 -2
- package/dist/{locator → types/locator}/utils.d.ts +1 -0
- package/dist/{utils → types/utils}/error.d.ts +0 -0
- package/dist/{utils → types/utils}/file-name.d.ts +0 -0
- package/dist/{utils → types/utils}/has-own-property.d.ts +0 -0
- package/dist/{utils → types/utils}/index.d.ts +0 -0
- package/dist/{utils → types/utils}/to-array.d.ts +0 -0
- package/package.json +29 -18
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/loader/file-type/index.js +0 -25
- package/dist/loader/file-type/index.js.map +0 -1
- package/dist/loader/file-type/json.d.ts +0 -2
- package/dist/loader/file-type/json.js +0 -46
- package/dist/loader/file-type/json.js.map +0 -1
- package/dist/loader/file-type/script/async.js +0 -78
- package/dist/loader/file-type/script/async.js.map +0 -1
- package/dist/loader/file-type/script/index.js +0 -27
- package/dist/loader/file-type/script/index.js.map +0 -1
- package/dist/loader/file-type/script/sync.js +0 -43
- package/dist/loader/file-type/script/sync.js.map +0 -1
- package/dist/loader/file-type/script/type.d.ts +0 -5
- package/dist/loader/file-type/script/type.js +0 -9
- package/dist/loader/file-type/script/type.js.map +0 -1
- package/dist/loader/file-type/script/utils.js +0 -33
- package/dist/loader/file-type/script/utils.js.map +0 -1
- package/dist/loader/index.js +0 -26
- package/dist/loader/index.js.map +0 -1
- package/dist/loader/module.d.ts +0 -3
- package/dist/loader/module.js +0 -45
- package/dist/loader/module.js.map +0 -1
- package/dist/loader/utils.d.ts +0 -2
- package/dist/loader/utils.js +0 -19
- package/dist/loader/utils.js.map +0 -1
- package/dist/locator/async.js +0 -85
- package/dist/locator/async.js.map +0 -1
- package/dist/locator/index.js +0 -27
- package/dist/locator/index.js.map +0 -1
- package/dist/locator/sync.js +0 -70
- package/dist/locator/sync.js.map +0 -1
- package/dist/locator/type.js +0 -9
- package/dist/locator/type.js.map +0 -1
- package/dist/locator/utils.js +0 -40
- package/dist/locator/utils.js.map +0 -1
- package/dist/utils/error.js +0 -21
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/file-name.js +0 -22
- package/dist/utils/file-name.js.map +0 -1
- package/dist/utils/has-own-property.js +0 -8
- package/dist/utils/has-own-property.js.map +0 -1
- package/dist/utils/index.js +0 -27
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/to-array.js +0 -14
- package/dist/utils/to-array.js.map +0 -1
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import isFileEsm from 'is-file-esm';
|
|
2
|
+
import { pathToFileURL } from 'url';
|
|
3
|
+
import { glob, sync } from 'glob';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
|
|
8
|
+
function _regeneratorRuntime() {
|
|
9
|
+
_regeneratorRuntime = function () {
|
|
10
|
+
return exports;
|
|
11
|
+
};
|
|
12
|
+
var exports = {},
|
|
13
|
+
Op = Object.prototype,
|
|
14
|
+
hasOwn = Op.hasOwnProperty,
|
|
15
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
16
|
+
obj[key] = desc.value;
|
|
17
|
+
},
|
|
18
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
19
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
20
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
21
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
22
|
+
function define(obj, key, value) {
|
|
23
|
+
return Object.defineProperty(obj, key, {
|
|
24
|
+
value: value,
|
|
25
|
+
enumerable: !0,
|
|
26
|
+
configurable: !0,
|
|
27
|
+
writable: !0
|
|
28
|
+
}), obj[key];
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
define({}, "");
|
|
32
|
+
} catch (err) {
|
|
33
|
+
define = function (obj, key, value) {
|
|
34
|
+
return obj[key] = value;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
38
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
39
|
+
generator = Object.create(protoGenerator.prototype),
|
|
40
|
+
context = new Context(tryLocsList || []);
|
|
41
|
+
return defineProperty(generator, "_invoke", {
|
|
42
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
43
|
+
}), generator;
|
|
44
|
+
}
|
|
45
|
+
function tryCatch(fn, obj, arg) {
|
|
46
|
+
try {
|
|
47
|
+
return {
|
|
48
|
+
type: "normal",
|
|
49
|
+
arg: fn.call(obj, arg)
|
|
50
|
+
};
|
|
51
|
+
} catch (err) {
|
|
52
|
+
return {
|
|
53
|
+
type: "throw",
|
|
54
|
+
arg: err
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.wrap = wrap;
|
|
59
|
+
var ContinueSentinel = {};
|
|
60
|
+
function Generator() {}
|
|
61
|
+
function GeneratorFunction() {}
|
|
62
|
+
function GeneratorFunctionPrototype() {}
|
|
63
|
+
var IteratorPrototype = {};
|
|
64
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
65
|
+
return this;
|
|
66
|
+
});
|
|
67
|
+
var getProto = Object.getPrototypeOf,
|
|
68
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
69
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
70
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
71
|
+
function defineIteratorMethods(prototype) {
|
|
72
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
73
|
+
define(prototype, method, function (arg) {
|
|
74
|
+
return this._invoke(method, arg);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
79
|
+
function invoke(method, arg, resolve, reject) {
|
|
80
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
81
|
+
if ("throw" !== record.type) {
|
|
82
|
+
var result = record.arg,
|
|
83
|
+
value = result.value;
|
|
84
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
85
|
+
invoke("next", value, resolve, reject);
|
|
86
|
+
}, function (err) {
|
|
87
|
+
invoke("throw", err, resolve, reject);
|
|
88
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
89
|
+
result.value = unwrapped, resolve(result);
|
|
90
|
+
}, function (error) {
|
|
91
|
+
return invoke("throw", error, resolve, reject);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
reject(record.arg);
|
|
95
|
+
}
|
|
96
|
+
var previousPromise;
|
|
97
|
+
defineProperty(this, "_invoke", {
|
|
98
|
+
value: function (method, arg) {
|
|
99
|
+
function callInvokeWithMethodAndArg() {
|
|
100
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
101
|
+
invoke(method, arg, resolve, reject);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
109
|
+
var state = "suspendedStart";
|
|
110
|
+
return function (method, arg) {
|
|
111
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
112
|
+
if ("completed" === state) {
|
|
113
|
+
if ("throw" === method) throw arg;
|
|
114
|
+
return doneResult();
|
|
115
|
+
}
|
|
116
|
+
for (context.method = method, context.arg = arg;;) {
|
|
117
|
+
var delegate = context.delegate;
|
|
118
|
+
if (delegate) {
|
|
119
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
120
|
+
if (delegateResult) {
|
|
121
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
122
|
+
return delegateResult;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
126
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
127
|
+
context.dispatchException(context.arg);
|
|
128
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
129
|
+
state = "executing";
|
|
130
|
+
var record = tryCatch(innerFn, self, context);
|
|
131
|
+
if ("normal" === record.type) {
|
|
132
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
133
|
+
return {
|
|
134
|
+
value: record.arg,
|
|
135
|
+
done: context.done
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
143
|
+
var methodName = context.method,
|
|
144
|
+
method = delegate.iterator[methodName];
|
|
145
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
146
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
147
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
148
|
+
var info = record.arg;
|
|
149
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
150
|
+
}
|
|
151
|
+
function pushTryEntry(locs) {
|
|
152
|
+
var entry = {
|
|
153
|
+
tryLoc: locs[0]
|
|
154
|
+
};
|
|
155
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
156
|
+
}
|
|
157
|
+
function resetTryEntry(entry) {
|
|
158
|
+
var record = entry.completion || {};
|
|
159
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
160
|
+
}
|
|
161
|
+
function Context(tryLocsList) {
|
|
162
|
+
this.tryEntries = [{
|
|
163
|
+
tryLoc: "root"
|
|
164
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
165
|
+
}
|
|
166
|
+
function values(iterable) {
|
|
167
|
+
if (iterable) {
|
|
168
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
169
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
170
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
171
|
+
if (!isNaN(iterable.length)) {
|
|
172
|
+
var i = -1,
|
|
173
|
+
next = function next() {
|
|
174
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
175
|
+
return next.value = undefined, next.done = !0, next;
|
|
176
|
+
};
|
|
177
|
+
return next.next = next;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
next: doneResult
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function doneResult() {
|
|
185
|
+
return {
|
|
186
|
+
value: undefined,
|
|
187
|
+
done: !0
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
191
|
+
value: GeneratorFunctionPrototype,
|
|
192
|
+
configurable: !0
|
|
193
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
194
|
+
value: GeneratorFunction,
|
|
195
|
+
configurable: !0
|
|
196
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
197
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
198
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
199
|
+
}, exports.mark = function (genFun) {
|
|
200
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
201
|
+
}, exports.awrap = function (arg) {
|
|
202
|
+
return {
|
|
203
|
+
__await: arg
|
|
204
|
+
};
|
|
205
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
206
|
+
return this;
|
|
207
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
208
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
209
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
210
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
211
|
+
return result.done ? result.value : iter.next();
|
|
212
|
+
});
|
|
213
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
214
|
+
return this;
|
|
215
|
+
}), define(Gp, "toString", function () {
|
|
216
|
+
return "[object Generator]";
|
|
217
|
+
}), exports.keys = function (val) {
|
|
218
|
+
var object = Object(val),
|
|
219
|
+
keys = [];
|
|
220
|
+
for (var key in object) keys.push(key);
|
|
221
|
+
return keys.reverse(), function next() {
|
|
222
|
+
for (; keys.length;) {
|
|
223
|
+
var key = keys.pop();
|
|
224
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
225
|
+
}
|
|
226
|
+
return next.done = !0, next;
|
|
227
|
+
};
|
|
228
|
+
}, exports.values = values, Context.prototype = {
|
|
229
|
+
constructor: Context,
|
|
230
|
+
reset: function (skipTempReset) {
|
|
231
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
232
|
+
},
|
|
233
|
+
stop: function () {
|
|
234
|
+
this.done = !0;
|
|
235
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
236
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
237
|
+
return this.rval;
|
|
238
|
+
},
|
|
239
|
+
dispatchException: function (exception) {
|
|
240
|
+
if (this.done) throw exception;
|
|
241
|
+
var context = this;
|
|
242
|
+
function handle(loc, caught) {
|
|
243
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
244
|
+
}
|
|
245
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
246
|
+
var entry = this.tryEntries[i],
|
|
247
|
+
record = entry.completion;
|
|
248
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
249
|
+
if (entry.tryLoc <= this.prev) {
|
|
250
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
251
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
252
|
+
if (hasCatch && hasFinally) {
|
|
253
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
254
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
255
|
+
} else if (hasCatch) {
|
|
256
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
257
|
+
} else {
|
|
258
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
259
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
abrupt: function (type, arg) {
|
|
265
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
266
|
+
var entry = this.tryEntries[i];
|
|
267
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
268
|
+
var finallyEntry = entry;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
273
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
274
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
275
|
+
},
|
|
276
|
+
complete: function (record, afterLoc) {
|
|
277
|
+
if ("throw" === record.type) throw record.arg;
|
|
278
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
279
|
+
},
|
|
280
|
+
finish: function (finallyLoc) {
|
|
281
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
282
|
+
var entry = this.tryEntries[i];
|
|
283
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
catch: function (tryLoc) {
|
|
287
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
288
|
+
var entry = this.tryEntries[i];
|
|
289
|
+
if (entry.tryLoc === tryLoc) {
|
|
290
|
+
var record = entry.completion;
|
|
291
|
+
if ("throw" === record.type) {
|
|
292
|
+
var thrown = record.arg;
|
|
293
|
+
resetTryEntry(entry);
|
|
294
|
+
}
|
|
295
|
+
return thrown;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
throw new Error("illegal catch attempt");
|
|
299
|
+
},
|
|
300
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
301
|
+
return this.delegate = {
|
|
302
|
+
iterator: values(iterable),
|
|
303
|
+
resultName: resultName,
|
|
304
|
+
nextLoc: nextLoc
|
|
305
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
306
|
+
}
|
|
307
|
+
}, exports;
|
|
308
|
+
}
|
|
309
|
+
function _typeof(obj) {
|
|
310
|
+
"@babel/helpers - typeof";
|
|
311
|
+
|
|
312
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
313
|
+
return typeof obj;
|
|
314
|
+
} : function (obj) {
|
|
315
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
316
|
+
}, _typeof(obj);
|
|
317
|
+
}
|
|
318
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
319
|
+
try {
|
|
320
|
+
var info = gen[key](arg);
|
|
321
|
+
var value = info.value;
|
|
322
|
+
} catch (error) {
|
|
323
|
+
reject(error);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (info.done) {
|
|
327
|
+
resolve(value);
|
|
328
|
+
} else {
|
|
329
|
+
Promise.resolve(value).then(_next, _throw);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function _asyncToGenerator(fn) {
|
|
333
|
+
return function () {
|
|
334
|
+
var self = this,
|
|
335
|
+
args = arguments;
|
|
336
|
+
return new Promise(function (resolve, reject) {
|
|
337
|
+
var gen = fn.apply(self, args);
|
|
338
|
+
function _next(value) {
|
|
339
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
340
|
+
}
|
|
341
|
+
function _throw(err) {
|
|
342
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
343
|
+
}
|
|
344
|
+
_next(undefined);
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/*
|
|
350
|
+
* Copyright (c) 2022.
|
|
351
|
+
* Author Peter Placzek (tada5hi)
|
|
352
|
+
* For the full copyright and license information,
|
|
353
|
+
* view the LICENSE file that was distributed with this source code.
|
|
354
|
+
*/
|
|
355
|
+
|
|
356
|
+
/* istanbul ignore next */
|
|
357
|
+
function handleFileLoadError(e) {
|
|
358
|
+
if (e instanceof Error) {
|
|
359
|
+
throw e;
|
|
360
|
+
}
|
|
361
|
+
if (typeof e === 'string') {
|
|
362
|
+
throw new Error(e);
|
|
363
|
+
}
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/*
|
|
368
|
+
* Copyright (c) 2022.
|
|
369
|
+
* Author Peter Placzek (tada5hi)
|
|
370
|
+
* For the full copyright and license information,
|
|
371
|
+
* view the LICENSE file that was distributed with this source code.
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
function removeFileNameExtension(input, extensions) {
|
|
375
|
+
if (input.includes('.')) {
|
|
376
|
+
var position = input.lastIndexOf('.');
|
|
377
|
+
var extension = input.substring(position, input.length);
|
|
378
|
+
if (typeof extensions === 'undefined' || extensions.indexOf(extension) !== -1) {
|
|
379
|
+
input = input.substring(0, position);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return input;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function hasOwnProperty(obj, prop) {
|
|
386
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/*
|
|
390
|
+
* Copyright (c) 2022.
|
|
391
|
+
* Author Peter Placzek (tada5hi)
|
|
392
|
+
* For the full copyright and license information,
|
|
393
|
+
* view the LICENSE file that was distributed with this source code.
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
function toArray(input) {
|
|
397
|
+
return Array.isArray(input) ? input : [input];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/*
|
|
401
|
+
* Copyright (c) 2022.
|
|
402
|
+
* Author Peter Placzek (tada5hi)
|
|
403
|
+
* For the full copyright and license information,
|
|
404
|
+
* view the LICENSE file that was distributed with this source code.
|
|
405
|
+
*/
|
|
406
|
+
function getExportItem(data, filterFn) {
|
|
407
|
+
if (filterFn) {
|
|
408
|
+
var keys = Object.keys(data);
|
|
409
|
+
for (var i = 0; i < keys.length; i++) {
|
|
410
|
+
if (filterFn(keys[i], data[keys[i]])) {
|
|
411
|
+
return {
|
|
412
|
+
key: keys[i],
|
|
413
|
+
value: data[keys[i]]
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
return {
|
|
419
|
+
key: 'default',
|
|
420
|
+
value: hasOwnProperty(data, 'default') ? data["default"] : data
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/* istanbul ignore next */
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function buildLocatorOptions(options) {
|
|
429
|
+
var _options, _options$ignore;
|
|
430
|
+
options = options || {};
|
|
431
|
+
options.path = options.path || [];
|
|
432
|
+
options.path = toArray(options.path);
|
|
433
|
+
if (options.path.length === 0) {
|
|
434
|
+
options.path.push(process.cwd());
|
|
435
|
+
}
|
|
436
|
+
(_options$ignore = (_options = options).ignore) !== null && _options$ignore !== void 0 ? _options$ignore : _options.ignore = [];
|
|
437
|
+
return options;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* istanbul ignore next */
|
|
441
|
+
function isLocatorInfo(data) {
|
|
442
|
+
if (_typeof(data) !== 'object') {
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
if (!hasOwnProperty(data, 'path') || typeof data.path !== 'string') {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
if (!hasOwnProperty(data, 'name') || typeof data.name !== 'string') {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
return !(!hasOwnProperty(data, 'extension') || typeof data.extension !== 'string');
|
|
452
|
+
}
|
|
453
|
+
function pathToLocatorInfo(input, skipResolve) {
|
|
454
|
+
if (!skipResolve && !path.isAbsolute(input)) {
|
|
455
|
+
input = path.resolve(process.cwd(), input);
|
|
456
|
+
}
|
|
457
|
+
var info = path.parse(input);
|
|
458
|
+
return {
|
|
459
|
+
path: info.dir.split('/').join(path.sep),
|
|
460
|
+
name: info.name,
|
|
461
|
+
extension: info.ext
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
var globAsync = promisify(glob);
|
|
466
|
+
function locateFiles(_x, _x2) {
|
|
467
|
+
return _locateFiles.apply(this, arguments);
|
|
468
|
+
}
|
|
469
|
+
function _locateFiles() {
|
|
470
|
+
_locateFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pattern, options) {
|
|
471
|
+
var patterns, items, i, j, files, k;
|
|
472
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
473
|
+
while (1) {
|
|
474
|
+
switch (_context.prev = _context.next) {
|
|
475
|
+
case 0:
|
|
476
|
+
options = buildLocatorOptions(options);
|
|
477
|
+
patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
478
|
+
items = [];
|
|
479
|
+
i = 0;
|
|
480
|
+
case 4:
|
|
481
|
+
if (!(i < patterns.length)) {
|
|
482
|
+
_context.next = 17;
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
j = 0;
|
|
486
|
+
case 6:
|
|
487
|
+
if (!(j < options.path.length)) {
|
|
488
|
+
_context.next = 14;
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
_context.next = 9;
|
|
492
|
+
return globAsync(patterns[i], {
|
|
493
|
+
absolute: true,
|
|
494
|
+
cwd: options.path[j],
|
|
495
|
+
nodir: true,
|
|
496
|
+
ignore: options.ignore
|
|
497
|
+
});
|
|
498
|
+
case 9:
|
|
499
|
+
files = _context.sent;
|
|
500
|
+
for (k = 0; k < files.length; k++) {
|
|
501
|
+
items.push(pathToLocatorInfo(files[k], true));
|
|
502
|
+
}
|
|
503
|
+
case 11:
|
|
504
|
+
j++;
|
|
505
|
+
_context.next = 6;
|
|
506
|
+
break;
|
|
507
|
+
case 14:
|
|
508
|
+
i++;
|
|
509
|
+
_context.next = 4;
|
|
510
|
+
break;
|
|
511
|
+
case 17:
|
|
512
|
+
return _context.abrupt("return", items);
|
|
513
|
+
case 18:
|
|
514
|
+
case "end":
|
|
515
|
+
return _context.stop();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}, _callee);
|
|
519
|
+
}));
|
|
520
|
+
return _locateFiles.apply(this, arguments);
|
|
521
|
+
}
|
|
522
|
+
function locateFile(_x3, _x4) {
|
|
523
|
+
return _locateFile.apply(this, arguments);
|
|
524
|
+
}
|
|
525
|
+
function _locateFile() {
|
|
526
|
+
_locateFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pattern, options) {
|
|
527
|
+
var patterns, i, j, files, element;
|
|
528
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
529
|
+
while (1) {
|
|
530
|
+
switch (_context2.prev = _context2.next) {
|
|
531
|
+
case 0:
|
|
532
|
+
options = buildLocatorOptions(options);
|
|
533
|
+
patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
534
|
+
i = 0;
|
|
535
|
+
case 3:
|
|
536
|
+
if (!(i < patterns.length)) {
|
|
537
|
+
_context2.next = 18;
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
j = 0;
|
|
541
|
+
case 5:
|
|
542
|
+
if (!(j < options.path.length)) {
|
|
543
|
+
_context2.next = 15;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
_context2.next = 8;
|
|
547
|
+
return globAsync(patterns[i], {
|
|
548
|
+
absolute: true,
|
|
549
|
+
cwd: options.path[j],
|
|
550
|
+
nodir: true,
|
|
551
|
+
ignore: options.ignore
|
|
552
|
+
});
|
|
553
|
+
case 8:
|
|
554
|
+
files = _context2.sent;
|
|
555
|
+
element = files.shift();
|
|
556
|
+
if (!element) {
|
|
557
|
+
_context2.next = 12;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
return _context2.abrupt("return", pathToLocatorInfo(element, true));
|
|
561
|
+
case 12:
|
|
562
|
+
j++;
|
|
563
|
+
_context2.next = 5;
|
|
564
|
+
break;
|
|
565
|
+
case 15:
|
|
566
|
+
i++;
|
|
567
|
+
_context2.next = 3;
|
|
568
|
+
break;
|
|
569
|
+
case 18:
|
|
570
|
+
return _context2.abrupt("return", undefined);
|
|
571
|
+
case 19:
|
|
572
|
+
case "end":
|
|
573
|
+
return _context2.stop();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}, _callee2);
|
|
577
|
+
}));
|
|
578
|
+
return _locateFile.apply(this, arguments);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/*
|
|
582
|
+
* Copyright (c) 2022.
|
|
583
|
+
* Author Peter Placzek (tada5hi)
|
|
584
|
+
* For the full copyright and license information,
|
|
585
|
+
* view the LICENSE file that was distributed with this source code.
|
|
586
|
+
*/
|
|
587
|
+
function locateFilesSync(pattern, options) {
|
|
588
|
+
options = buildLocatorOptions(options);
|
|
589
|
+
var patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
590
|
+
var items = [];
|
|
591
|
+
for (var i = 0; i < patterns.length; i++) {
|
|
592
|
+
for (var j = 0; j < options.path.length; j++) {
|
|
593
|
+
var files = sync(patterns[i], {
|
|
594
|
+
absolute: true,
|
|
595
|
+
cwd: options.path[j],
|
|
596
|
+
nodir: true,
|
|
597
|
+
ignore: options.ignore
|
|
598
|
+
});
|
|
599
|
+
for (var k = 0; k < files.length; k++) {
|
|
600
|
+
items.push(pathToLocatorInfo(files[k], true));
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return items;
|
|
605
|
+
}
|
|
606
|
+
function locateFileSync(pattern, options) {
|
|
607
|
+
options = buildLocatorOptions(options);
|
|
608
|
+
var patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
609
|
+
for (var i = 0; i < patterns.length; i++) {
|
|
610
|
+
for (var j = 0; j < options.path.length; j++) {
|
|
611
|
+
var files = sync(patterns[i], {
|
|
612
|
+
absolute: true,
|
|
613
|
+
cwd: options.path[j],
|
|
614
|
+
nodir: true,
|
|
615
|
+
ignore: options.ignore
|
|
616
|
+
});
|
|
617
|
+
var element = files.shift();
|
|
618
|
+
if (element) {
|
|
619
|
+
return pathToLocatorInfo(element, true);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/*
|
|
627
|
+
* Copyright (c) 2022.
|
|
628
|
+
* Author Peter Placzek (tada5hi)
|
|
629
|
+
* For the full copyright and license information,
|
|
630
|
+
* view the LICENSE file that was distributed with this source code.
|
|
631
|
+
*/
|
|
632
|
+
function buildLoaderFilePath(info, withExtension) {
|
|
633
|
+
if (withExtension) {
|
|
634
|
+
return path.join(info.path, info.name) + info.extension;
|
|
635
|
+
}
|
|
636
|
+
return path.join(info.path, info.name);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function loadScriptFile(_x) {
|
|
640
|
+
return _loadScriptFile.apply(this, arguments);
|
|
641
|
+
}
|
|
642
|
+
function _loadScriptFile() {
|
|
643
|
+
_loadScriptFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
644
|
+
var locatorInfo, filePath, check;
|
|
645
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
646
|
+
while (1) {
|
|
647
|
+
switch (_context.prev = _context.next) {
|
|
648
|
+
case 0:
|
|
649
|
+
if (typeof data === 'string') {
|
|
650
|
+
filePath = data;
|
|
651
|
+
locatorInfo = pathToLocatorInfo(data);
|
|
652
|
+
} else {
|
|
653
|
+
filePath = buildLoaderFilePath(data, true);
|
|
654
|
+
locatorInfo = data;
|
|
655
|
+
}
|
|
656
|
+
_context.prev = 1;
|
|
657
|
+
if (!(['.js', '.mjs', '.cjs'].indexOf(locatorInfo.extension) !== -1)) {
|
|
658
|
+
_context.next = 10;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
_context.next = 5;
|
|
662
|
+
return isFileEsm(filePath);
|
|
663
|
+
case 5:
|
|
664
|
+
check = _context.sent;
|
|
665
|
+
if (!check.esm) {
|
|
666
|
+
_context.next = 10;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
_context.next = 9;
|
|
670
|
+
return import(pathToFileURL(filePath).href);
|
|
671
|
+
case 9:
|
|
672
|
+
return _context.abrupt("return", _context.sent);
|
|
673
|
+
case 10:
|
|
674
|
+
_context.next = 12;
|
|
675
|
+
return import(filePath);
|
|
676
|
+
case 12:
|
|
677
|
+
return _context.abrupt("return", _context.sent);
|
|
678
|
+
case 15:
|
|
679
|
+
_context.prev = 15;
|
|
680
|
+
_context.t0 = _context["catch"](1);
|
|
681
|
+
return _context.abrupt("return", handleFileLoadError(_context.t0));
|
|
682
|
+
case 18:
|
|
683
|
+
case "end":
|
|
684
|
+
return _context.stop();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}, _callee, null, [[1, 15]]);
|
|
688
|
+
}));
|
|
689
|
+
return _loadScriptFile.apply(this, arguments);
|
|
690
|
+
}
|
|
691
|
+
function loadScriptFileExport(_x2, _x3) {
|
|
692
|
+
return _loadScriptFileExport.apply(this, arguments);
|
|
693
|
+
}
|
|
694
|
+
function _loadScriptFileExport() {
|
|
695
|
+
_loadScriptFileExport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, filterFn) {
|
|
696
|
+
var output;
|
|
697
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
698
|
+
while (1) {
|
|
699
|
+
switch (_context2.prev = _context2.next) {
|
|
700
|
+
case 0:
|
|
701
|
+
_context2.prev = 0;
|
|
702
|
+
_context2.next = 3;
|
|
703
|
+
return loadScriptFile(data);
|
|
704
|
+
case 3:
|
|
705
|
+
output = _context2.sent;
|
|
706
|
+
if (!(_typeof(output) === 'object')) {
|
|
707
|
+
_context2.next = 6;
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
return _context2.abrupt("return", getExportItem(output, filterFn));
|
|
711
|
+
case 6:
|
|
712
|
+
return _context2.abrupt("return", undefined);
|
|
713
|
+
case 9:
|
|
714
|
+
_context2.prev = 9;
|
|
715
|
+
_context2.t0 = _context2["catch"](0);
|
|
716
|
+
return _context2.abrupt("return", handleFileLoadError(_context2.t0));
|
|
717
|
+
case 12:
|
|
718
|
+
case "end":
|
|
719
|
+
return _context2.stop();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}, _callee2, null, [[0, 9]]);
|
|
723
|
+
}));
|
|
724
|
+
return _loadScriptFileExport.apply(this, arguments);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function loadScriptFileSync(data) {
|
|
728
|
+
var filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data;
|
|
729
|
+
try {
|
|
730
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require,import/no-dynamic-require
|
|
731
|
+
return require(filePath);
|
|
732
|
+
} catch (e) {
|
|
733
|
+
return handleFileLoadError(e);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function loadScriptFileExportSync(data, filterFn) {
|
|
737
|
+
var filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data;
|
|
738
|
+
try {
|
|
739
|
+
var _data = loadScriptFileSync(filePath);
|
|
740
|
+
if (_typeof(_data) === 'object') {
|
|
741
|
+
return getExportItem(_data, filterFn);
|
|
742
|
+
}
|
|
743
|
+
return undefined;
|
|
744
|
+
} catch (e) {
|
|
745
|
+
return handleFileLoadError(e);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function loadJsonFile(_x) {
|
|
750
|
+
return _loadJsonFile.apply(this, arguments);
|
|
751
|
+
}
|
|
752
|
+
function _loadJsonFile() {
|
|
753
|
+
_loadJsonFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) {
|
|
754
|
+
var filePath, file;
|
|
755
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
756
|
+
while (1) {
|
|
757
|
+
switch (_context.prev = _context.next) {
|
|
758
|
+
case 0:
|
|
759
|
+
filePath = buildLoaderFilePath(info, true);
|
|
760
|
+
_context.prev = 1;
|
|
761
|
+
_context.next = 4;
|
|
762
|
+
return fs.promises.readFile(filePath);
|
|
763
|
+
case 4:
|
|
764
|
+
file = _context.sent;
|
|
765
|
+
return _context.abrupt("return", JSON.parse(file.toString('utf-8')));
|
|
766
|
+
case 8:
|
|
767
|
+
_context.prev = 8;
|
|
768
|
+
_context.t0 = _context["catch"](1);
|
|
769
|
+
return _context.abrupt("return", handleFileLoadError(_context.t0));
|
|
770
|
+
case 11:
|
|
771
|
+
case "end":
|
|
772
|
+
return _context.stop();
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}, _callee, null, [[1, 8]]);
|
|
776
|
+
}));
|
|
777
|
+
return _loadJsonFile.apply(this, arguments);
|
|
778
|
+
}
|
|
779
|
+
function loadJsonFileSync(info) {
|
|
780
|
+
var filePath = buildLoaderFilePath(info, true);
|
|
781
|
+
try {
|
|
782
|
+
var file = fs.readFileSync(filePath);
|
|
783
|
+
return JSON.parse(file.toString('utf-8'));
|
|
784
|
+
} catch (e) {
|
|
785
|
+
return handleFileLoadError(e);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function loadFile(_x) {
|
|
790
|
+
return _loadFile.apply(this, arguments);
|
|
791
|
+
}
|
|
792
|
+
function _loadFile() {
|
|
793
|
+
_loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
|
|
794
|
+
var info;
|
|
795
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
796
|
+
while (1) {
|
|
797
|
+
switch (_context.prev = _context.next) {
|
|
798
|
+
case 0:
|
|
799
|
+
if (input) {
|
|
800
|
+
_context.next = 2;
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
return _context.abrupt("return", undefined);
|
|
804
|
+
case 2:
|
|
805
|
+
if (typeof input === 'string') {
|
|
806
|
+
info = pathToLocatorInfo(input);
|
|
807
|
+
} else {
|
|
808
|
+
info = input;
|
|
809
|
+
}
|
|
810
|
+
if (!(info.extension === '.json')) {
|
|
811
|
+
_context.next = 5;
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
return _context.abrupt("return", loadJsonFile(info));
|
|
815
|
+
case 5:
|
|
816
|
+
return _context.abrupt("return", loadScriptFile(info));
|
|
817
|
+
case 6:
|
|
818
|
+
case "end":
|
|
819
|
+
return _context.stop();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}, _callee);
|
|
823
|
+
}));
|
|
824
|
+
return _loadFile.apply(this, arguments);
|
|
825
|
+
}
|
|
826
|
+
function loadFileSync(input) {
|
|
827
|
+
if (!input) {
|
|
828
|
+
return undefined;
|
|
829
|
+
}
|
|
830
|
+
var info;
|
|
831
|
+
if (typeof input === 'string') {
|
|
832
|
+
info = pathToLocatorInfo(input);
|
|
833
|
+
} else {
|
|
834
|
+
info = input;
|
|
835
|
+
}
|
|
836
|
+
if (info.extension === '.json') {
|
|
837
|
+
return loadJsonFileSync(info);
|
|
838
|
+
}
|
|
839
|
+
return loadScriptFileSync(info);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export { buildLoaderFilePath, buildLocatorOptions, getExportItem, handleFileLoadError, hasOwnProperty, isLocatorInfo, loadFile, loadFileSync, loadJsonFile, loadJsonFileSync, loadScriptFile, loadScriptFileExport, loadScriptFileExportSync, loadScriptFileSync, locateFile, locateFileSync, locateFiles, locateFilesSync, pathToLocatorInfo, removeFileNameExtension, toArray };
|