@lynxwall/cucumber-tsflow 7.2.0 → 7.3.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/README.md +59 -35
- package/lib/api/load-configuration.js +60 -16
- package/lib/api/load-configuration.js.map +1 -1
- package/lib/bindings/binding-context.d.ts +40 -4
- package/lib/bindings/binding-context.js +50 -6
- package/lib/bindings/binding-context.js.map +1 -1
- package/lib/bindings/binding-decorator.js +32 -9
- package/lib/bindings/binding-decorator.js.map +1 -1
- package/lib/bindings/binding-registry.js +10 -0
- package/lib/bindings/binding-registry.js.map +1 -1
- package/lib/bindings/hook-decorators.js +4 -3
- package/lib/bindings/hook-decorators.js.map +1 -1
- package/lib/bindings/step-decorators.js +12 -9
- package/lib/bindings/step-decorators.js.map +1 -1
- package/lib/cli/argv-parser.js +1 -2
- package/lib/cli/argv-parser.js.map +1 -1
- package/lib/runtime/parallel/worker.js +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test-case-runner.d.ts +2 -1
- package/lib/runtime/test-case-runner.js +8 -5
- package/lib/runtime/test-case-runner.js.map +1 -1
- package/lib/transpilers/esbuild-transpiler.d.ts +1 -1
- package/lib/transpilers/esbuild-transpiler.js.map +1 -1
- package/lib/transpilers/esbuild.js.map +1 -1
- package/lib/transpilers/esm/esbuild-transpiler-cjs.js +2174 -0
- package/lib/transpilers/esm/esbuild-transpiler.mjs +19 -0
- package/lib/transpilers/esm/esbuild.mjs +141 -0
- package/lib/transpilers/esm/esmbuild-transpiler.d.ts +4 -0
- package/lib/transpilers/esm/esmbuild-transpiler.js +19 -0
- package/lib/transpilers/esm/esmbuild-transpiler.js.map +1 -0
- package/lib/transpilers/esm/esmbuild.d.ts +12 -0
- package/lib/transpilers/esm/esmbuild.js +72 -0
- package/lib/transpilers/esm/esmbuild.js.map +1 -0
- package/lib/transpilers/esm/esmnode.d.ts +1 -0
- package/lib/transpilers/esm/esmnode.js +8 -0
- package/lib/transpilers/esm/esmnode.js.map +1 -0
- package/lib/transpilers/esm/esmvue.d.ts +1 -0
- package/lib/transpilers/esm/esmvue.js +29 -0
- package/lib/transpilers/esm/esmvue.js.map +1 -0
- package/lib/transpilers/esm/esnode-loader.mjs +9 -0
- package/lib/transpilers/esm/esvue-loader.mjs +9 -0
- package/lib/transpilers/esm/loader-utils.mjs +278 -0
- package/lib/transpilers/esm/tsnode-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsnode-esm.js +25 -0
- package/lib/transpilers/esm/tsnode-esm.js.map +1 -0
- package/lib/transpilers/esm/tsnode-exp-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsnode-exp-esm.js +19 -0
- package/lib/transpilers/esm/tsnode-exp-esm.js.map +1 -0
- package/lib/transpilers/esm/tsnode-loader.mjs +107 -0
- package/lib/transpilers/esm/tsnode-service.mjs +40 -0
- package/lib/transpilers/esm/tsvue-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsvue-esm.js +40 -0
- package/lib/transpilers/esm/tsvue-esm.js.map +1 -0
- package/lib/transpilers/esm/tsvue-exp-esm.d.ts +1 -0
- package/lib/transpilers/esm/tsvue-exp-esm.js +40 -0
- package/lib/transpilers/esm/tsvue-exp-esm.js.map +1 -0
- package/lib/transpilers/esm/vue-jsdom-setup.mjs +19 -0
- package/lib/transpilers/esm/vue-loader.mjs +113 -0
- package/lib/transpilers/esm/vue-sfc-compiler.mjs +216 -0
- package/lib/transpilers/esnode.js +1 -1
- package/lib/transpilers/esnode.js.map +1 -1
- package/lib/transpilers/esvue.js +1 -1
- package/lib/transpilers/esvue.js.map +1 -1
- package/lib/transpilers/tsnode-exp.js +1 -1
- package/lib/transpilers/tsnode-exp.js.map +1 -1
- package/lib/transpilers/tsnode.js +1 -1
- package/lib/transpilers/tsnode.js.map +1 -1
- package/lib/transpilers/tsvue-exp.js +1 -1
- package/lib/transpilers/tsvue-exp.js.map +1 -1
- package/lib/transpilers/tsvue.js +2 -2
- package/lib/transpilers/tsvue.js.map +1 -1
- package/lib/transpilers/vue-sfc/index.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +27 -17
|
@@ -0,0 +1,2174 @@
|
|
|
1
|
+
/* Auto-generated CJS wrapper for ESM esbuild transpiler */
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// ../node_modules/tsconfig-paths/lib/filesystem.js
|
|
34
|
+
var require_filesystem = __commonJS({
|
|
35
|
+
"../node_modules/tsconfig-paths/lib/filesystem.js"(exports2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38
|
+
exports2.removeExtension = exports2.fileExistsAsync = exports2.readJsonFromDiskAsync = exports2.readJsonFromDiskSync = exports2.fileExistsSync = void 0;
|
|
39
|
+
var fs = require("fs");
|
|
40
|
+
function fileExistsSync(path2) {
|
|
41
|
+
if (!fs.existsSync(path2)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
var stats = fs.statSync(path2);
|
|
46
|
+
return stats.isFile();
|
|
47
|
+
} catch (err) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports2.fileExistsSync = fileExistsSync;
|
|
52
|
+
function readJsonFromDiskSync(packageJsonPath) {
|
|
53
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
return require(packageJsonPath);
|
|
57
|
+
}
|
|
58
|
+
exports2.readJsonFromDiskSync = readJsonFromDiskSync;
|
|
59
|
+
function readJsonFromDiskAsync(path2, callback) {
|
|
60
|
+
fs.readFile(path2, "utf8", function(err, result) {
|
|
61
|
+
if (err || !result) {
|
|
62
|
+
return callback();
|
|
63
|
+
}
|
|
64
|
+
var json = JSON.parse(result);
|
|
65
|
+
return callback(void 0, json);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports2.readJsonFromDiskAsync = readJsonFromDiskAsync;
|
|
69
|
+
function fileExistsAsync(path2, callback2) {
|
|
70
|
+
fs.stat(path2, function(err, stats) {
|
|
71
|
+
if (err) {
|
|
72
|
+
return callback2(void 0, false);
|
|
73
|
+
}
|
|
74
|
+
callback2(void 0, stats ? stats.isFile() : false);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports2.fileExistsAsync = fileExistsAsync;
|
|
78
|
+
function removeExtension(path2) {
|
|
79
|
+
return path2.substring(0, path2.lastIndexOf(".")) || path2;
|
|
80
|
+
}
|
|
81
|
+
exports2.removeExtension = removeExtension;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// ../node_modules/tsconfig-paths/lib/mapping-entry.js
|
|
86
|
+
var require_mapping_entry = __commonJS({
|
|
87
|
+
"../node_modules/tsconfig-paths/lib/mapping-entry.js"(exports2) {
|
|
88
|
+
"use strict";
|
|
89
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
90
|
+
exports2.getAbsoluteMappingEntries = void 0;
|
|
91
|
+
var path2 = require("path");
|
|
92
|
+
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
|
93
|
+
var sortedKeys = sortByLongestPrefix(Object.keys(paths));
|
|
94
|
+
var absolutePaths = [];
|
|
95
|
+
for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
|
|
96
|
+
var key = sortedKeys_1[_i];
|
|
97
|
+
absolutePaths.push({
|
|
98
|
+
pattern: key,
|
|
99
|
+
paths: paths[key].map(function(pathToResolve) {
|
|
100
|
+
return path2.resolve(absoluteBaseUrl, pathToResolve);
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (!paths["*"] && addMatchAll) {
|
|
105
|
+
absolutePaths.push({
|
|
106
|
+
pattern: "*",
|
|
107
|
+
paths: ["".concat(absoluteBaseUrl.replace(/\/$/, ""), "/*")]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return absolutePaths;
|
|
111
|
+
}
|
|
112
|
+
exports2.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
|
|
113
|
+
function sortByLongestPrefix(arr) {
|
|
114
|
+
return arr.concat().sort(function(a, b) {
|
|
115
|
+
return getPrefixLength(b) - getPrefixLength(a);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function getPrefixLength(pattern) {
|
|
119
|
+
var prefixLength = pattern.indexOf("*");
|
|
120
|
+
return pattern.substr(0, prefixLength).length;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ../node_modules/tsconfig-paths/lib/try-path.js
|
|
126
|
+
var require_try_path = __commonJS({
|
|
127
|
+
"../node_modules/tsconfig-paths/lib/try-path.js"(exports2) {
|
|
128
|
+
"use strict";
|
|
129
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
130
|
+
exports2.exhaustiveTypeException = exports2.getStrippedPath = exports2.getPathsToTry = void 0;
|
|
131
|
+
var path2 = require("path");
|
|
132
|
+
var path_1 = require("path");
|
|
133
|
+
var filesystem_1 = require_filesystem();
|
|
134
|
+
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
|
135
|
+
if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
var pathsToTry = [];
|
|
139
|
+
for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
|
|
140
|
+
var entry = absolutePathMappings_1[_i];
|
|
141
|
+
var starMatch = entry.pattern === requestedModule ? "" : matchStar(entry.pattern, requestedModule);
|
|
142
|
+
if (starMatch !== void 0) {
|
|
143
|
+
var _loop_1 = function(physicalPathPattern2) {
|
|
144
|
+
var physicalPath = physicalPathPattern2.replace("*", starMatch);
|
|
145
|
+
pathsToTry.push({ type: "file", path: physicalPath });
|
|
146
|
+
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
147
|
+
return { type: "extension", path: physicalPath + e };
|
|
148
|
+
}));
|
|
149
|
+
pathsToTry.push({
|
|
150
|
+
type: "package",
|
|
151
|
+
path: path2.join(physicalPath, "/package.json")
|
|
152
|
+
});
|
|
153
|
+
var indexPath = path2.join(physicalPath, "/index");
|
|
154
|
+
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
155
|
+
return { type: "index", path: indexPath + e };
|
|
156
|
+
}));
|
|
157
|
+
};
|
|
158
|
+
for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
|
|
159
|
+
var physicalPathPattern = _b[_a];
|
|
160
|
+
_loop_1(physicalPathPattern);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return pathsToTry.length === 0 ? void 0 : pathsToTry;
|
|
165
|
+
}
|
|
166
|
+
exports2.getPathsToTry = getPathsToTry;
|
|
167
|
+
function getStrippedPath(tryPath) {
|
|
168
|
+
return tryPath.type === "index" ? (0, path_1.dirname)(tryPath.path) : tryPath.type === "file" ? tryPath.path : tryPath.type === "extension" ? (0, filesystem_1.removeExtension)(tryPath.path) : tryPath.type === "package" ? tryPath.path : exhaustiveTypeException(tryPath.type);
|
|
169
|
+
}
|
|
170
|
+
exports2.getStrippedPath = getStrippedPath;
|
|
171
|
+
function exhaustiveTypeException(check) {
|
|
172
|
+
throw new Error("Unknown type ".concat(check));
|
|
173
|
+
}
|
|
174
|
+
exports2.exhaustiveTypeException = exhaustiveTypeException;
|
|
175
|
+
function matchStar(pattern, search) {
|
|
176
|
+
if (search.length < pattern.length) {
|
|
177
|
+
return void 0;
|
|
178
|
+
}
|
|
179
|
+
if (pattern === "*") {
|
|
180
|
+
return search;
|
|
181
|
+
}
|
|
182
|
+
var star = pattern.indexOf("*");
|
|
183
|
+
if (star === -1) {
|
|
184
|
+
return void 0;
|
|
185
|
+
}
|
|
186
|
+
var part1 = pattern.substring(0, star);
|
|
187
|
+
var part2 = pattern.substring(star + 1);
|
|
188
|
+
if (search.substr(0, star) !== part1) {
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
if (search.substr(search.length - part2.length) !== part2) {
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
return search.substr(star, search.length - part2.length);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// ../node_modules/tsconfig-paths/lib/match-path-sync.js
|
|
200
|
+
var require_match_path_sync = __commonJS({
|
|
201
|
+
"../node_modules/tsconfig-paths/lib/match-path-sync.js"(exports2) {
|
|
202
|
+
"use strict";
|
|
203
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
204
|
+
exports2.matchFromAbsolutePaths = exports2.createMatchPath = void 0;
|
|
205
|
+
var path2 = require("path");
|
|
206
|
+
var Filesystem = require_filesystem();
|
|
207
|
+
var MappingEntry = require_mapping_entry();
|
|
208
|
+
var TryPath = require_try_path();
|
|
209
|
+
function createMatchPath(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
210
|
+
if (mainFields === void 0) {
|
|
211
|
+
mainFields = ["main"];
|
|
212
|
+
}
|
|
213
|
+
if (addMatchAll === void 0) {
|
|
214
|
+
addMatchAll = true;
|
|
215
|
+
}
|
|
216
|
+
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
217
|
+
return function(requestedModule, readJson, fileExists, extensions) {
|
|
218
|
+
return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
exports2.createMatchPath = createMatchPath;
|
|
222
|
+
function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) {
|
|
223
|
+
if (readJson === void 0) {
|
|
224
|
+
readJson = Filesystem.readJsonFromDiskSync;
|
|
225
|
+
}
|
|
226
|
+
if (fileExists === void 0) {
|
|
227
|
+
fileExists = Filesystem.fileExistsSync;
|
|
228
|
+
}
|
|
229
|
+
if (extensions === void 0) {
|
|
230
|
+
extensions = Object.keys(require.extensions);
|
|
231
|
+
}
|
|
232
|
+
if (mainFields === void 0) {
|
|
233
|
+
mainFields = ["main"];
|
|
234
|
+
}
|
|
235
|
+
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
|
|
236
|
+
if (!tryPaths) {
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
|
|
240
|
+
}
|
|
241
|
+
exports2.matchFromAbsolutePaths = matchFromAbsolutePaths;
|
|
242
|
+
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) {
|
|
243
|
+
for (var index = 0; index < mainFields.length; index++) {
|
|
244
|
+
var mainFieldSelector = mainFields[index];
|
|
245
|
+
var candidateMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key) {
|
|
246
|
+
return obj[key];
|
|
247
|
+
}, packageJson);
|
|
248
|
+
if (candidateMapping && typeof candidateMapping === "string") {
|
|
249
|
+
var candidateFilePath = path2.join(path2.dirname(packageJsonPath), candidateMapping);
|
|
250
|
+
if (fileExists(candidateFilePath)) {
|
|
251
|
+
return candidateFilePath;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return void 0;
|
|
256
|
+
}
|
|
257
|
+
function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) {
|
|
258
|
+
if (readJson === void 0) {
|
|
259
|
+
readJson = Filesystem.readJsonFromDiskSync;
|
|
260
|
+
}
|
|
261
|
+
if (mainFields === void 0) {
|
|
262
|
+
mainFields = ["main"];
|
|
263
|
+
}
|
|
264
|
+
for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) {
|
|
265
|
+
var tryPath = tryPaths_1[_i];
|
|
266
|
+
if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
|
|
267
|
+
if (fileExists(tryPath.path)) {
|
|
268
|
+
return TryPath.getStrippedPath(tryPath);
|
|
269
|
+
}
|
|
270
|
+
} else if (tryPath.type === "package") {
|
|
271
|
+
var packageJson = readJson(tryPath.path);
|
|
272
|
+
if (packageJson) {
|
|
273
|
+
var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists);
|
|
274
|
+
if (mainFieldMappedFile) {
|
|
275
|
+
return mainFieldMappedFile;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
TryPath.exhaustiveTypeException(tryPath.type);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return void 0;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// ../node_modules/tsconfig-paths/lib/match-path-async.js
|
|
288
|
+
var require_match_path_async = __commonJS({
|
|
289
|
+
"../node_modules/tsconfig-paths/lib/match-path-async.js"(exports2) {
|
|
290
|
+
"use strict";
|
|
291
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
292
|
+
exports2.matchFromAbsolutePathsAsync = exports2.createMatchPathAsync = void 0;
|
|
293
|
+
var path2 = require("path");
|
|
294
|
+
var TryPath = require_try_path();
|
|
295
|
+
var MappingEntry = require_mapping_entry();
|
|
296
|
+
var Filesystem = require_filesystem();
|
|
297
|
+
function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
|
|
298
|
+
if (mainFields === void 0) {
|
|
299
|
+
mainFields = ["main"];
|
|
300
|
+
}
|
|
301
|
+
if (addMatchAll === void 0) {
|
|
302
|
+
addMatchAll = true;
|
|
303
|
+
}
|
|
304
|
+
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
|
|
305
|
+
return function(requestedModule, readJson, fileExists, extensions, callback) {
|
|
306
|
+
return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields);
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
exports2.createMatchPathAsync = createMatchPathAsync;
|
|
310
|
+
function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) {
|
|
311
|
+
if (readJson === void 0) {
|
|
312
|
+
readJson = Filesystem.readJsonFromDiskAsync;
|
|
313
|
+
}
|
|
314
|
+
if (fileExists === void 0) {
|
|
315
|
+
fileExists = Filesystem.fileExistsAsync;
|
|
316
|
+
}
|
|
317
|
+
if (extensions === void 0) {
|
|
318
|
+
extensions = Object.keys(require.extensions);
|
|
319
|
+
}
|
|
320
|
+
if (mainFields === void 0) {
|
|
321
|
+
mainFields = ["main"];
|
|
322
|
+
}
|
|
323
|
+
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
|
|
324
|
+
if (!tryPaths) {
|
|
325
|
+
return callback();
|
|
326
|
+
}
|
|
327
|
+
findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields);
|
|
328
|
+
}
|
|
329
|
+
exports2.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync;
|
|
330
|
+
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index) {
|
|
331
|
+
if (index === void 0) {
|
|
332
|
+
index = 0;
|
|
333
|
+
}
|
|
334
|
+
if (index >= mainFields.length) {
|
|
335
|
+
return doneCallback(void 0, void 0);
|
|
336
|
+
}
|
|
337
|
+
var tryNext = function() {
|
|
338
|
+
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index + 1);
|
|
339
|
+
};
|
|
340
|
+
var mainFieldSelector = mainFields[index];
|
|
341
|
+
var mainFieldMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key) {
|
|
342
|
+
return obj[key];
|
|
343
|
+
}, packageJson);
|
|
344
|
+
if (typeof mainFieldMapping !== "string") {
|
|
345
|
+
return tryNext();
|
|
346
|
+
}
|
|
347
|
+
var mappedFilePath = path2.join(path2.dirname(packageJsonPath), mainFieldMapping);
|
|
348
|
+
fileExistsAsync(mappedFilePath, function(err, exists) {
|
|
349
|
+
if (err) {
|
|
350
|
+
return doneCallback(err);
|
|
351
|
+
}
|
|
352
|
+
if (exists) {
|
|
353
|
+
return doneCallback(void 0, mappedFilePath);
|
|
354
|
+
}
|
|
355
|
+
return tryNext();
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index, mainFields) {
|
|
359
|
+
if (index === void 0) {
|
|
360
|
+
index = 0;
|
|
361
|
+
}
|
|
362
|
+
if (mainFields === void 0) {
|
|
363
|
+
mainFields = ["main"];
|
|
364
|
+
}
|
|
365
|
+
var tryPath = tryPaths[index];
|
|
366
|
+
if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
|
|
367
|
+
fileExists(tryPath.path, function(err, exists) {
|
|
368
|
+
if (err) {
|
|
369
|
+
return doneCallback(err);
|
|
370
|
+
}
|
|
371
|
+
if (exists) {
|
|
372
|
+
return doneCallback(void 0, TryPath.getStrippedPath(tryPath));
|
|
373
|
+
}
|
|
374
|
+
if (index === tryPaths.length - 1) {
|
|
375
|
+
return doneCallback();
|
|
376
|
+
}
|
|
377
|
+
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
|
378
|
+
});
|
|
379
|
+
} else if (tryPath.type === "package") {
|
|
380
|
+
readJson(tryPath.path, function(err, packageJson) {
|
|
381
|
+
if (err) {
|
|
382
|
+
return doneCallback(err);
|
|
383
|
+
}
|
|
384
|
+
if (packageJson) {
|
|
385
|
+
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function(mainFieldErr, mainFieldMappedFile) {
|
|
386
|
+
if (mainFieldErr) {
|
|
387
|
+
return doneCallback(mainFieldErr);
|
|
388
|
+
}
|
|
389
|
+
if (mainFieldMappedFile) {
|
|
390
|
+
return doneCallback(void 0, mainFieldMappedFile);
|
|
391
|
+
}
|
|
392
|
+
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
|
|
396
|
+
});
|
|
397
|
+
} else {
|
|
398
|
+
TryPath.exhaustiveTypeException(tryPath.type);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
// ../node_modules/json5/lib/unicode.js
|
|
405
|
+
var require_unicode = __commonJS({
|
|
406
|
+
"../node_modules/json5/lib/unicode.js"(exports2, module2) {
|
|
407
|
+
module2.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
408
|
+
module2.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
|
|
409
|
+
module2.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// ../node_modules/json5/lib/util.js
|
|
414
|
+
var require_util = __commonJS({
|
|
415
|
+
"../node_modules/json5/lib/util.js"(exports2, module2) {
|
|
416
|
+
var unicode = require_unicode();
|
|
417
|
+
module2.exports = {
|
|
418
|
+
isSpaceSeparator(c) {
|
|
419
|
+
return typeof c === "string" && unicode.Space_Separator.test(c);
|
|
420
|
+
},
|
|
421
|
+
isIdStartChar(c) {
|
|
422
|
+
return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
|
|
423
|
+
},
|
|
424
|
+
isIdContinueChar(c) {
|
|
425
|
+
return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c));
|
|
426
|
+
},
|
|
427
|
+
isDigit(c) {
|
|
428
|
+
return typeof c === "string" && /[0-9]/.test(c);
|
|
429
|
+
},
|
|
430
|
+
isHexDigit(c) {
|
|
431
|
+
return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// ../node_modules/json5/lib/parse.js
|
|
438
|
+
var require_parse = __commonJS({
|
|
439
|
+
"../node_modules/json5/lib/parse.js"(exports2, module2) {
|
|
440
|
+
var util = require_util();
|
|
441
|
+
var source;
|
|
442
|
+
var parseState;
|
|
443
|
+
var stack;
|
|
444
|
+
var pos;
|
|
445
|
+
var line;
|
|
446
|
+
var column;
|
|
447
|
+
var token;
|
|
448
|
+
var key;
|
|
449
|
+
var root;
|
|
450
|
+
module2.exports = function parse(text, reviver) {
|
|
451
|
+
source = String(text);
|
|
452
|
+
parseState = "start";
|
|
453
|
+
stack = [];
|
|
454
|
+
pos = 0;
|
|
455
|
+
line = 1;
|
|
456
|
+
column = 0;
|
|
457
|
+
token = void 0;
|
|
458
|
+
key = void 0;
|
|
459
|
+
root = void 0;
|
|
460
|
+
do {
|
|
461
|
+
token = lex();
|
|
462
|
+
parseStates[parseState]();
|
|
463
|
+
} while (token.type !== "eof");
|
|
464
|
+
if (typeof reviver === "function") {
|
|
465
|
+
return internalize({ "": root }, "", reviver);
|
|
466
|
+
}
|
|
467
|
+
return root;
|
|
468
|
+
};
|
|
469
|
+
function internalize(holder, name, reviver) {
|
|
470
|
+
const value = holder[name];
|
|
471
|
+
if (value != null && typeof value === "object") {
|
|
472
|
+
if (Array.isArray(value)) {
|
|
473
|
+
for (let i = 0; i < value.length; i++) {
|
|
474
|
+
const key2 = String(i);
|
|
475
|
+
const replacement = internalize(value, key2, reviver);
|
|
476
|
+
if (replacement === void 0) {
|
|
477
|
+
delete value[key2];
|
|
478
|
+
} else {
|
|
479
|
+
Object.defineProperty(value, key2, {
|
|
480
|
+
value: replacement,
|
|
481
|
+
writable: true,
|
|
482
|
+
enumerable: true,
|
|
483
|
+
configurable: true
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
for (const key2 in value) {
|
|
489
|
+
const replacement = internalize(value, key2, reviver);
|
|
490
|
+
if (replacement === void 0) {
|
|
491
|
+
delete value[key2];
|
|
492
|
+
} else {
|
|
493
|
+
Object.defineProperty(value, key2, {
|
|
494
|
+
value: replacement,
|
|
495
|
+
writable: true,
|
|
496
|
+
enumerable: true,
|
|
497
|
+
configurable: true
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return reviver.call(holder, name, value);
|
|
504
|
+
}
|
|
505
|
+
var lexState;
|
|
506
|
+
var buffer;
|
|
507
|
+
var doubleQuote;
|
|
508
|
+
var sign;
|
|
509
|
+
var c;
|
|
510
|
+
function lex() {
|
|
511
|
+
lexState = "default";
|
|
512
|
+
buffer = "";
|
|
513
|
+
doubleQuote = false;
|
|
514
|
+
sign = 1;
|
|
515
|
+
for (; ; ) {
|
|
516
|
+
c = peek();
|
|
517
|
+
const token2 = lexStates[lexState]();
|
|
518
|
+
if (token2) {
|
|
519
|
+
return token2;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function peek() {
|
|
524
|
+
if (source[pos]) {
|
|
525
|
+
return String.fromCodePoint(source.codePointAt(pos));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function read() {
|
|
529
|
+
const c2 = peek();
|
|
530
|
+
if (c2 === "\n") {
|
|
531
|
+
line++;
|
|
532
|
+
column = 0;
|
|
533
|
+
} else if (c2) {
|
|
534
|
+
column += c2.length;
|
|
535
|
+
} else {
|
|
536
|
+
column++;
|
|
537
|
+
}
|
|
538
|
+
if (c2) {
|
|
539
|
+
pos += c2.length;
|
|
540
|
+
}
|
|
541
|
+
return c2;
|
|
542
|
+
}
|
|
543
|
+
var lexStates = {
|
|
544
|
+
default() {
|
|
545
|
+
switch (c) {
|
|
546
|
+
case " ":
|
|
547
|
+
case "\v":
|
|
548
|
+
case "\f":
|
|
549
|
+
case " ":
|
|
550
|
+
case "\xA0":
|
|
551
|
+
case "\uFEFF":
|
|
552
|
+
case "\n":
|
|
553
|
+
case "\r":
|
|
554
|
+
case "\u2028":
|
|
555
|
+
case "\u2029":
|
|
556
|
+
read();
|
|
557
|
+
return;
|
|
558
|
+
case "/":
|
|
559
|
+
read();
|
|
560
|
+
lexState = "comment";
|
|
561
|
+
return;
|
|
562
|
+
case void 0:
|
|
563
|
+
read();
|
|
564
|
+
return newToken("eof");
|
|
565
|
+
}
|
|
566
|
+
if (util.isSpaceSeparator(c)) {
|
|
567
|
+
read();
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
return lexStates[parseState]();
|
|
571
|
+
},
|
|
572
|
+
comment() {
|
|
573
|
+
switch (c) {
|
|
574
|
+
case "*":
|
|
575
|
+
read();
|
|
576
|
+
lexState = "multiLineComment";
|
|
577
|
+
return;
|
|
578
|
+
case "/":
|
|
579
|
+
read();
|
|
580
|
+
lexState = "singleLineComment";
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
throw invalidChar(read());
|
|
584
|
+
},
|
|
585
|
+
multiLineComment() {
|
|
586
|
+
switch (c) {
|
|
587
|
+
case "*":
|
|
588
|
+
read();
|
|
589
|
+
lexState = "multiLineCommentAsterisk";
|
|
590
|
+
return;
|
|
591
|
+
case void 0:
|
|
592
|
+
throw invalidChar(read());
|
|
593
|
+
}
|
|
594
|
+
read();
|
|
595
|
+
},
|
|
596
|
+
multiLineCommentAsterisk() {
|
|
597
|
+
switch (c) {
|
|
598
|
+
case "*":
|
|
599
|
+
read();
|
|
600
|
+
return;
|
|
601
|
+
case "/":
|
|
602
|
+
read();
|
|
603
|
+
lexState = "default";
|
|
604
|
+
return;
|
|
605
|
+
case void 0:
|
|
606
|
+
throw invalidChar(read());
|
|
607
|
+
}
|
|
608
|
+
read();
|
|
609
|
+
lexState = "multiLineComment";
|
|
610
|
+
},
|
|
611
|
+
singleLineComment() {
|
|
612
|
+
switch (c) {
|
|
613
|
+
case "\n":
|
|
614
|
+
case "\r":
|
|
615
|
+
case "\u2028":
|
|
616
|
+
case "\u2029":
|
|
617
|
+
read();
|
|
618
|
+
lexState = "default";
|
|
619
|
+
return;
|
|
620
|
+
case void 0:
|
|
621
|
+
read();
|
|
622
|
+
return newToken("eof");
|
|
623
|
+
}
|
|
624
|
+
read();
|
|
625
|
+
},
|
|
626
|
+
value() {
|
|
627
|
+
switch (c) {
|
|
628
|
+
case "{":
|
|
629
|
+
case "[":
|
|
630
|
+
return newToken("punctuator", read());
|
|
631
|
+
case "n":
|
|
632
|
+
read();
|
|
633
|
+
literal("ull");
|
|
634
|
+
return newToken("null", null);
|
|
635
|
+
case "t":
|
|
636
|
+
read();
|
|
637
|
+
literal("rue");
|
|
638
|
+
return newToken("boolean", true);
|
|
639
|
+
case "f":
|
|
640
|
+
read();
|
|
641
|
+
literal("alse");
|
|
642
|
+
return newToken("boolean", false);
|
|
643
|
+
case "-":
|
|
644
|
+
case "+":
|
|
645
|
+
if (read() === "-") {
|
|
646
|
+
sign = -1;
|
|
647
|
+
}
|
|
648
|
+
lexState = "sign";
|
|
649
|
+
return;
|
|
650
|
+
case ".":
|
|
651
|
+
buffer = read();
|
|
652
|
+
lexState = "decimalPointLeading";
|
|
653
|
+
return;
|
|
654
|
+
case "0":
|
|
655
|
+
buffer = read();
|
|
656
|
+
lexState = "zero";
|
|
657
|
+
return;
|
|
658
|
+
case "1":
|
|
659
|
+
case "2":
|
|
660
|
+
case "3":
|
|
661
|
+
case "4":
|
|
662
|
+
case "5":
|
|
663
|
+
case "6":
|
|
664
|
+
case "7":
|
|
665
|
+
case "8":
|
|
666
|
+
case "9":
|
|
667
|
+
buffer = read();
|
|
668
|
+
lexState = "decimalInteger";
|
|
669
|
+
return;
|
|
670
|
+
case "I":
|
|
671
|
+
read();
|
|
672
|
+
literal("nfinity");
|
|
673
|
+
return newToken("numeric", Infinity);
|
|
674
|
+
case "N":
|
|
675
|
+
read();
|
|
676
|
+
literal("aN");
|
|
677
|
+
return newToken("numeric", NaN);
|
|
678
|
+
case '"':
|
|
679
|
+
case "'":
|
|
680
|
+
doubleQuote = read() === '"';
|
|
681
|
+
buffer = "";
|
|
682
|
+
lexState = "string";
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
throw invalidChar(read());
|
|
686
|
+
},
|
|
687
|
+
identifierNameStartEscape() {
|
|
688
|
+
if (c !== "u") {
|
|
689
|
+
throw invalidChar(read());
|
|
690
|
+
}
|
|
691
|
+
read();
|
|
692
|
+
const u = unicodeEscape();
|
|
693
|
+
switch (u) {
|
|
694
|
+
case "$":
|
|
695
|
+
case "_":
|
|
696
|
+
break;
|
|
697
|
+
default:
|
|
698
|
+
if (!util.isIdStartChar(u)) {
|
|
699
|
+
throw invalidIdentifier();
|
|
700
|
+
}
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
buffer += u;
|
|
704
|
+
lexState = "identifierName";
|
|
705
|
+
},
|
|
706
|
+
identifierName() {
|
|
707
|
+
switch (c) {
|
|
708
|
+
case "$":
|
|
709
|
+
case "_":
|
|
710
|
+
case "\u200C":
|
|
711
|
+
case "\u200D":
|
|
712
|
+
buffer += read();
|
|
713
|
+
return;
|
|
714
|
+
case "\\":
|
|
715
|
+
read();
|
|
716
|
+
lexState = "identifierNameEscape";
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (util.isIdContinueChar(c)) {
|
|
720
|
+
buffer += read();
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
return newToken("identifier", buffer);
|
|
724
|
+
},
|
|
725
|
+
identifierNameEscape() {
|
|
726
|
+
if (c !== "u") {
|
|
727
|
+
throw invalidChar(read());
|
|
728
|
+
}
|
|
729
|
+
read();
|
|
730
|
+
const u = unicodeEscape();
|
|
731
|
+
switch (u) {
|
|
732
|
+
case "$":
|
|
733
|
+
case "_":
|
|
734
|
+
case "\u200C":
|
|
735
|
+
case "\u200D":
|
|
736
|
+
break;
|
|
737
|
+
default:
|
|
738
|
+
if (!util.isIdContinueChar(u)) {
|
|
739
|
+
throw invalidIdentifier();
|
|
740
|
+
}
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
buffer += u;
|
|
744
|
+
lexState = "identifierName";
|
|
745
|
+
},
|
|
746
|
+
sign() {
|
|
747
|
+
switch (c) {
|
|
748
|
+
case ".":
|
|
749
|
+
buffer = read();
|
|
750
|
+
lexState = "decimalPointLeading";
|
|
751
|
+
return;
|
|
752
|
+
case "0":
|
|
753
|
+
buffer = read();
|
|
754
|
+
lexState = "zero";
|
|
755
|
+
return;
|
|
756
|
+
case "1":
|
|
757
|
+
case "2":
|
|
758
|
+
case "3":
|
|
759
|
+
case "4":
|
|
760
|
+
case "5":
|
|
761
|
+
case "6":
|
|
762
|
+
case "7":
|
|
763
|
+
case "8":
|
|
764
|
+
case "9":
|
|
765
|
+
buffer = read();
|
|
766
|
+
lexState = "decimalInteger";
|
|
767
|
+
return;
|
|
768
|
+
case "I":
|
|
769
|
+
read();
|
|
770
|
+
literal("nfinity");
|
|
771
|
+
return newToken("numeric", sign * Infinity);
|
|
772
|
+
case "N":
|
|
773
|
+
read();
|
|
774
|
+
literal("aN");
|
|
775
|
+
return newToken("numeric", NaN);
|
|
776
|
+
}
|
|
777
|
+
throw invalidChar(read());
|
|
778
|
+
},
|
|
779
|
+
zero() {
|
|
780
|
+
switch (c) {
|
|
781
|
+
case ".":
|
|
782
|
+
buffer += read();
|
|
783
|
+
lexState = "decimalPoint";
|
|
784
|
+
return;
|
|
785
|
+
case "e":
|
|
786
|
+
case "E":
|
|
787
|
+
buffer += read();
|
|
788
|
+
lexState = "decimalExponent";
|
|
789
|
+
return;
|
|
790
|
+
case "x":
|
|
791
|
+
case "X":
|
|
792
|
+
buffer += read();
|
|
793
|
+
lexState = "hexadecimal";
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
return newToken("numeric", sign * 0);
|
|
797
|
+
},
|
|
798
|
+
decimalInteger() {
|
|
799
|
+
switch (c) {
|
|
800
|
+
case ".":
|
|
801
|
+
buffer += read();
|
|
802
|
+
lexState = "decimalPoint";
|
|
803
|
+
return;
|
|
804
|
+
case "e":
|
|
805
|
+
case "E":
|
|
806
|
+
buffer += read();
|
|
807
|
+
lexState = "decimalExponent";
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
if (util.isDigit(c)) {
|
|
811
|
+
buffer += read();
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
return newToken("numeric", sign * Number(buffer));
|
|
815
|
+
},
|
|
816
|
+
decimalPointLeading() {
|
|
817
|
+
if (util.isDigit(c)) {
|
|
818
|
+
buffer += read();
|
|
819
|
+
lexState = "decimalFraction";
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
throw invalidChar(read());
|
|
823
|
+
},
|
|
824
|
+
decimalPoint() {
|
|
825
|
+
switch (c) {
|
|
826
|
+
case "e":
|
|
827
|
+
case "E":
|
|
828
|
+
buffer += read();
|
|
829
|
+
lexState = "decimalExponent";
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (util.isDigit(c)) {
|
|
833
|
+
buffer += read();
|
|
834
|
+
lexState = "decimalFraction";
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
return newToken("numeric", sign * Number(buffer));
|
|
838
|
+
},
|
|
839
|
+
decimalFraction() {
|
|
840
|
+
switch (c) {
|
|
841
|
+
case "e":
|
|
842
|
+
case "E":
|
|
843
|
+
buffer += read();
|
|
844
|
+
lexState = "decimalExponent";
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (util.isDigit(c)) {
|
|
848
|
+
buffer += read();
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
return newToken("numeric", sign * Number(buffer));
|
|
852
|
+
},
|
|
853
|
+
decimalExponent() {
|
|
854
|
+
switch (c) {
|
|
855
|
+
case "+":
|
|
856
|
+
case "-":
|
|
857
|
+
buffer += read();
|
|
858
|
+
lexState = "decimalExponentSign";
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
if (util.isDigit(c)) {
|
|
862
|
+
buffer += read();
|
|
863
|
+
lexState = "decimalExponentInteger";
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
throw invalidChar(read());
|
|
867
|
+
},
|
|
868
|
+
decimalExponentSign() {
|
|
869
|
+
if (util.isDigit(c)) {
|
|
870
|
+
buffer += read();
|
|
871
|
+
lexState = "decimalExponentInteger";
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
throw invalidChar(read());
|
|
875
|
+
},
|
|
876
|
+
decimalExponentInteger() {
|
|
877
|
+
if (util.isDigit(c)) {
|
|
878
|
+
buffer += read();
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
return newToken("numeric", sign * Number(buffer));
|
|
882
|
+
},
|
|
883
|
+
hexadecimal() {
|
|
884
|
+
if (util.isHexDigit(c)) {
|
|
885
|
+
buffer += read();
|
|
886
|
+
lexState = "hexadecimalInteger";
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
throw invalidChar(read());
|
|
890
|
+
},
|
|
891
|
+
hexadecimalInteger() {
|
|
892
|
+
if (util.isHexDigit(c)) {
|
|
893
|
+
buffer += read();
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
return newToken("numeric", sign * Number(buffer));
|
|
897
|
+
},
|
|
898
|
+
string() {
|
|
899
|
+
switch (c) {
|
|
900
|
+
case "\\":
|
|
901
|
+
read();
|
|
902
|
+
buffer += escape();
|
|
903
|
+
return;
|
|
904
|
+
case '"':
|
|
905
|
+
if (doubleQuote) {
|
|
906
|
+
read();
|
|
907
|
+
return newToken("string", buffer);
|
|
908
|
+
}
|
|
909
|
+
buffer += read();
|
|
910
|
+
return;
|
|
911
|
+
case "'":
|
|
912
|
+
if (!doubleQuote) {
|
|
913
|
+
read();
|
|
914
|
+
return newToken("string", buffer);
|
|
915
|
+
}
|
|
916
|
+
buffer += read();
|
|
917
|
+
return;
|
|
918
|
+
case "\n":
|
|
919
|
+
case "\r":
|
|
920
|
+
throw invalidChar(read());
|
|
921
|
+
case "\u2028":
|
|
922
|
+
case "\u2029":
|
|
923
|
+
separatorChar(c);
|
|
924
|
+
break;
|
|
925
|
+
case void 0:
|
|
926
|
+
throw invalidChar(read());
|
|
927
|
+
}
|
|
928
|
+
buffer += read();
|
|
929
|
+
},
|
|
930
|
+
start() {
|
|
931
|
+
switch (c) {
|
|
932
|
+
case "{":
|
|
933
|
+
case "[":
|
|
934
|
+
return newToken("punctuator", read());
|
|
935
|
+
}
|
|
936
|
+
lexState = "value";
|
|
937
|
+
},
|
|
938
|
+
beforePropertyName() {
|
|
939
|
+
switch (c) {
|
|
940
|
+
case "$":
|
|
941
|
+
case "_":
|
|
942
|
+
buffer = read();
|
|
943
|
+
lexState = "identifierName";
|
|
944
|
+
return;
|
|
945
|
+
case "\\":
|
|
946
|
+
read();
|
|
947
|
+
lexState = "identifierNameStartEscape";
|
|
948
|
+
return;
|
|
949
|
+
case "}":
|
|
950
|
+
return newToken("punctuator", read());
|
|
951
|
+
case '"':
|
|
952
|
+
case "'":
|
|
953
|
+
doubleQuote = read() === '"';
|
|
954
|
+
lexState = "string";
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if (util.isIdStartChar(c)) {
|
|
958
|
+
buffer += read();
|
|
959
|
+
lexState = "identifierName";
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
throw invalidChar(read());
|
|
963
|
+
},
|
|
964
|
+
afterPropertyName() {
|
|
965
|
+
if (c === ":") {
|
|
966
|
+
return newToken("punctuator", read());
|
|
967
|
+
}
|
|
968
|
+
throw invalidChar(read());
|
|
969
|
+
},
|
|
970
|
+
beforePropertyValue() {
|
|
971
|
+
lexState = "value";
|
|
972
|
+
},
|
|
973
|
+
afterPropertyValue() {
|
|
974
|
+
switch (c) {
|
|
975
|
+
case ",":
|
|
976
|
+
case "}":
|
|
977
|
+
return newToken("punctuator", read());
|
|
978
|
+
}
|
|
979
|
+
throw invalidChar(read());
|
|
980
|
+
},
|
|
981
|
+
beforeArrayValue() {
|
|
982
|
+
if (c === "]") {
|
|
983
|
+
return newToken("punctuator", read());
|
|
984
|
+
}
|
|
985
|
+
lexState = "value";
|
|
986
|
+
},
|
|
987
|
+
afterArrayValue() {
|
|
988
|
+
switch (c) {
|
|
989
|
+
case ",":
|
|
990
|
+
case "]":
|
|
991
|
+
return newToken("punctuator", read());
|
|
992
|
+
}
|
|
993
|
+
throw invalidChar(read());
|
|
994
|
+
},
|
|
995
|
+
end() {
|
|
996
|
+
throw invalidChar(read());
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
function newToken(type, value) {
|
|
1000
|
+
return {
|
|
1001
|
+
type,
|
|
1002
|
+
value,
|
|
1003
|
+
line,
|
|
1004
|
+
column
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function literal(s) {
|
|
1008
|
+
for (const c2 of s) {
|
|
1009
|
+
const p = peek();
|
|
1010
|
+
if (p !== c2) {
|
|
1011
|
+
throw invalidChar(read());
|
|
1012
|
+
}
|
|
1013
|
+
read();
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
function escape() {
|
|
1017
|
+
const c2 = peek();
|
|
1018
|
+
switch (c2) {
|
|
1019
|
+
case "b":
|
|
1020
|
+
read();
|
|
1021
|
+
return "\b";
|
|
1022
|
+
case "f":
|
|
1023
|
+
read();
|
|
1024
|
+
return "\f";
|
|
1025
|
+
case "n":
|
|
1026
|
+
read();
|
|
1027
|
+
return "\n";
|
|
1028
|
+
case "r":
|
|
1029
|
+
read();
|
|
1030
|
+
return "\r";
|
|
1031
|
+
case "t":
|
|
1032
|
+
read();
|
|
1033
|
+
return " ";
|
|
1034
|
+
case "v":
|
|
1035
|
+
read();
|
|
1036
|
+
return "\v";
|
|
1037
|
+
case "0":
|
|
1038
|
+
read();
|
|
1039
|
+
if (util.isDigit(peek())) {
|
|
1040
|
+
throw invalidChar(read());
|
|
1041
|
+
}
|
|
1042
|
+
return "\0";
|
|
1043
|
+
case "x":
|
|
1044
|
+
read();
|
|
1045
|
+
return hexEscape();
|
|
1046
|
+
case "u":
|
|
1047
|
+
read();
|
|
1048
|
+
return unicodeEscape();
|
|
1049
|
+
case "\n":
|
|
1050
|
+
case "\u2028":
|
|
1051
|
+
case "\u2029":
|
|
1052
|
+
read();
|
|
1053
|
+
return "";
|
|
1054
|
+
case "\r":
|
|
1055
|
+
read();
|
|
1056
|
+
if (peek() === "\n") {
|
|
1057
|
+
read();
|
|
1058
|
+
}
|
|
1059
|
+
return "";
|
|
1060
|
+
case "1":
|
|
1061
|
+
case "2":
|
|
1062
|
+
case "3":
|
|
1063
|
+
case "4":
|
|
1064
|
+
case "5":
|
|
1065
|
+
case "6":
|
|
1066
|
+
case "7":
|
|
1067
|
+
case "8":
|
|
1068
|
+
case "9":
|
|
1069
|
+
throw invalidChar(read());
|
|
1070
|
+
case void 0:
|
|
1071
|
+
throw invalidChar(read());
|
|
1072
|
+
}
|
|
1073
|
+
return read();
|
|
1074
|
+
}
|
|
1075
|
+
function hexEscape() {
|
|
1076
|
+
let buffer2 = "";
|
|
1077
|
+
let c2 = peek();
|
|
1078
|
+
if (!util.isHexDigit(c2)) {
|
|
1079
|
+
throw invalidChar(read());
|
|
1080
|
+
}
|
|
1081
|
+
buffer2 += read();
|
|
1082
|
+
c2 = peek();
|
|
1083
|
+
if (!util.isHexDigit(c2)) {
|
|
1084
|
+
throw invalidChar(read());
|
|
1085
|
+
}
|
|
1086
|
+
buffer2 += read();
|
|
1087
|
+
return String.fromCodePoint(parseInt(buffer2, 16));
|
|
1088
|
+
}
|
|
1089
|
+
function unicodeEscape() {
|
|
1090
|
+
let buffer2 = "";
|
|
1091
|
+
let count = 4;
|
|
1092
|
+
while (count-- > 0) {
|
|
1093
|
+
const c2 = peek();
|
|
1094
|
+
if (!util.isHexDigit(c2)) {
|
|
1095
|
+
throw invalidChar(read());
|
|
1096
|
+
}
|
|
1097
|
+
buffer2 += read();
|
|
1098
|
+
}
|
|
1099
|
+
return String.fromCodePoint(parseInt(buffer2, 16));
|
|
1100
|
+
}
|
|
1101
|
+
var parseStates = {
|
|
1102
|
+
start() {
|
|
1103
|
+
if (token.type === "eof") {
|
|
1104
|
+
throw invalidEOF();
|
|
1105
|
+
}
|
|
1106
|
+
push();
|
|
1107
|
+
},
|
|
1108
|
+
beforePropertyName() {
|
|
1109
|
+
switch (token.type) {
|
|
1110
|
+
case "identifier":
|
|
1111
|
+
case "string":
|
|
1112
|
+
key = token.value;
|
|
1113
|
+
parseState = "afterPropertyName";
|
|
1114
|
+
return;
|
|
1115
|
+
case "punctuator":
|
|
1116
|
+
pop();
|
|
1117
|
+
return;
|
|
1118
|
+
case "eof":
|
|
1119
|
+
throw invalidEOF();
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
afterPropertyName() {
|
|
1123
|
+
if (token.type === "eof") {
|
|
1124
|
+
throw invalidEOF();
|
|
1125
|
+
}
|
|
1126
|
+
parseState = "beforePropertyValue";
|
|
1127
|
+
},
|
|
1128
|
+
beforePropertyValue() {
|
|
1129
|
+
if (token.type === "eof") {
|
|
1130
|
+
throw invalidEOF();
|
|
1131
|
+
}
|
|
1132
|
+
push();
|
|
1133
|
+
},
|
|
1134
|
+
beforeArrayValue() {
|
|
1135
|
+
if (token.type === "eof") {
|
|
1136
|
+
throw invalidEOF();
|
|
1137
|
+
}
|
|
1138
|
+
if (token.type === "punctuator" && token.value === "]") {
|
|
1139
|
+
pop();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
push();
|
|
1143
|
+
},
|
|
1144
|
+
afterPropertyValue() {
|
|
1145
|
+
if (token.type === "eof") {
|
|
1146
|
+
throw invalidEOF();
|
|
1147
|
+
}
|
|
1148
|
+
switch (token.value) {
|
|
1149
|
+
case ",":
|
|
1150
|
+
parseState = "beforePropertyName";
|
|
1151
|
+
return;
|
|
1152
|
+
case "}":
|
|
1153
|
+
pop();
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
afterArrayValue() {
|
|
1157
|
+
if (token.type === "eof") {
|
|
1158
|
+
throw invalidEOF();
|
|
1159
|
+
}
|
|
1160
|
+
switch (token.value) {
|
|
1161
|
+
case ",":
|
|
1162
|
+
parseState = "beforeArrayValue";
|
|
1163
|
+
return;
|
|
1164
|
+
case "]":
|
|
1165
|
+
pop();
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
end() {
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
function push() {
|
|
1172
|
+
let value;
|
|
1173
|
+
switch (token.type) {
|
|
1174
|
+
case "punctuator":
|
|
1175
|
+
switch (token.value) {
|
|
1176
|
+
case "{":
|
|
1177
|
+
value = {};
|
|
1178
|
+
break;
|
|
1179
|
+
case "[":
|
|
1180
|
+
value = [];
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
break;
|
|
1184
|
+
case "null":
|
|
1185
|
+
case "boolean":
|
|
1186
|
+
case "numeric":
|
|
1187
|
+
case "string":
|
|
1188
|
+
value = token.value;
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
if (root === void 0) {
|
|
1192
|
+
root = value;
|
|
1193
|
+
} else {
|
|
1194
|
+
const parent = stack[stack.length - 1];
|
|
1195
|
+
if (Array.isArray(parent)) {
|
|
1196
|
+
parent.push(value);
|
|
1197
|
+
} else {
|
|
1198
|
+
Object.defineProperty(parent, key, {
|
|
1199
|
+
value,
|
|
1200
|
+
writable: true,
|
|
1201
|
+
enumerable: true,
|
|
1202
|
+
configurable: true
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
if (value !== null && typeof value === "object") {
|
|
1207
|
+
stack.push(value);
|
|
1208
|
+
if (Array.isArray(value)) {
|
|
1209
|
+
parseState = "beforeArrayValue";
|
|
1210
|
+
} else {
|
|
1211
|
+
parseState = "beforePropertyName";
|
|
1212
|
+
}
|
|
1213
|
+
} else {
|
|
1214
|
+
const current = stack[stack.length - 1];
|
|
1215
|
+
if (current == null) {
|
|
1216
|
+
parseState = "end";
|
|
1217
|
+
} else if (Array.isArray(current)) {
|
|
1218
|
+
parseState = "afterArrayValue";
|
|
1219
|
+
} else {
|
|
1220
|
+
parseState = "afterPropertyValue";
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
function pop() {
|
|
1225
|
+
stack.pop();
|
|
1226
|
+
const current = stack[stack.length - 1];
|
|
1227
|
+
if (current == null) {
|
|
1228
|
+
parseState = "end";
|
|
1229
|
+
} else if (Array.isArray(current)) {
|
|
1230
|
+
parseState = "afterArrayValue";
|
|
1231
|
+
} else {
|
|
1232
|
+
parseState = "afterPropertyValue";
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
function invalidChar(c2) {
|
|
1236
|
+
if (c2 === void 0) {
|
|
1237
|
+
return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
|
1238
|
+
}
|
|
1239
|
+
return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
|
|
1240
|
+
}
|
|
1241
|
+
function invalidEOF() {
|
|
1242
|
+
return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
|
1243
|
+
}
|
|
1244
|
+
function invalidIdentifier() {
|
|
1245
|
+
column -= 5;
|
|
1246
|
+
return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
|
|
1247
|
+
}
|
|
1248
|
+
function separatorChar(c2) {
|
|
1249
|
+
console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
|
|
1250
|
+
}
|
|
1251
|
+
function formatChar(c2) {
|
|
1252
|
+
const replacements = {
|
|
1253
|
+
"'": "\\'",
|
|
1254
|
+
'"': '\\"',
|
|
1255
|
+
"\\": "\\\\",
|
|
1256
|
+
"\b": "\\b",
|
|
1257
|
+
"\f": "\\f",
|
|
1258
|
+
"\n": "\\n",
|
|
1259
|
+
"\r": "\\r",
|
|
1260
|
+
" ": "\\t",
|
|
1261
|
+
"\v": "\\v",
|
|
1262
|
+
"\0": "\\0",
|
|
1263
|
+
"\u2028": "\\u2028",
|
|
1264
|
+
"\u2029": "\\u2029"
|
|
1265
|
+
};
|
|
1266
|
+
if (replacements[c2]) {
|
|
1267
|
+
return replacements[c2];
|
|
1268
|
+
}
|
|
1269
|
+
if (c2 < " ") {
|
|
1270
|
+
const hexString = c2.charCodeAt(0).toString(16);
|
|
1271
|
+
return "\\x" + ("00" + hexString).substring(hexString.length);
|
|
1272
|
+
}
|
|
1273
|
+
return c2;
|
|
1274
|
+
}
|
|
1275
|
+
function syntaxError(message) {
|
|
1276
|
+
const err = new SyntaxError(message);
|
|
1277
|
+
err.lineNumber = line;
|
|
1278
|
+
err.columnNumber = column;
|
|
1279
|
+
return err;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
// ../node_modules/json5/lib/stringify.js
|
|
1285
|
+
var require_stringify = __commonJS({
|
|
1286
|
+
"../node_modules/json5/lib/stringify.js"(exports2, module2) {
|
|
1287
|
+
var util = require_util();
|
|
1288
|
+
module2.exports = function stringify(value, replacer, space) {
|
|
1289
|
+
const stack = [];
|
|
1290
|
+
let indent = "";
|
|
1291
|
+
let propertyList;
|
|
1292
|
+
let replacerFunc;
|
|
1293
|
+
let gap = "";
|
|
1294
|
+
let quote;
|
|
1295
|
+
if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
|
|
1296
|
+
space = replacer.space;
|
|
1297
|
+
quote = replacer.quote;
|
|
1298
|
+
replacer = replacer.replacer;
|
|
1299
|
+
}
|
|
1300
|
+
if (typeof replacer === "function") {
|
|
1301
|
+
replacerFunc = replacer;
|
|
1302
|
+
} else if (Array.isArray(replacer)) {
|
|
1303
|
+
propertyList = [];
|
|
1304
|
+
for (const v of replacer) {
|
|
1305
|
+
let item;
|
|
1306
|
+
if (typeof v === "string") {
|
|
1307
|
+
item = v;
|
|
1308
|
+
} else if (typeof v === "number" || v instanceof String || v instanceof Number) {
|
|
1309
|
+
item = String(v);
|
|
1310
|
+
}
|
|
1311
|
+
if (item !== void 0 && propertyList.indexOf(item) < 0) {
|
|
1312
|
+
propertyList.push(item);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (space instanceof Number) {
|
|
1317
|
+
space = Number(space);
|
|
1318
|
+
} else if (space instanceof String) {
|
|
1319
|
+
space = String(space);
|
|
1320
|
+
}
|
|
1321
|
+
if (typeof space === "number") {
|
|
1322
|
+
if (space > 0) {
|
|
1323
|
+
space = Math.min(10, Math.floor(space));
|
|
1324
|
+
gap = " ".substr(0, space);
|
|
1325
|
+
}
|
|
1326
|
+
} else if (typeof space === "string") {
|
|
1327
|
+
gap = space.substr(0, 10);
|
|
1328
|
+
}
|
|
1329
|
+
return serializeProperty("", { "": value });
|
|
1330
|
+
function serializeProperty(key, holder) {
|
|
1331
|
+
let value2 = holder[key];
|
|
1332
|
+
if (value2 != null) {
|
|
1333
|
+
if (typeof value2.toJSON5 === "function") {
|
|
1334
|
+
value2 = value2.toJSON5(key);
|
|
1335
|
+
} else if (typeof value2.toJSON === "function") {
|
|
1336
|
+
value2 = value2.toJSON(key);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (replacerFunc) {
|
|
1340
|
+
value2 = replacerFunc.call(holder, key, value2);
|
|
1341
|
+
}
|
|
1342
|
+
if (value2 instanceof Number) {
|
|
1343
|
+
value2 = Number(value2);
|
|
1344
|
+
} else if (value2 instanceof String) {
|
|
1345
|
+
value2 = String(value2);
|
|
1346
|
+
} else if (value2 instanceof Boolean) {
|
|
1347
|
+
value2 = value2.valueOf();
|
|
1348
|
+
}
|
|
1349
|
+
switch (value2) {
|
|
1350
|
+
case null:
|
|
1351
|
+
return "null";
|
|
1352
|
+
case true:
|
|
1353
|
+
return "true";
|
|
1354
|
+
case false:
|
|
1355
|
+
return "false";
|
|
1356
|
+
}
|
|
1357
|
+
if (typeof value2 === "string") {
|
|
1358
|
+
return quoteString(value2, false);
|
|
1359
|
+
}
|
|
1360
|
+
if (typeof value2 === "number") {
|
|
1361
|
+
return String(value2);
|
|
1362
|
+
}
|
|
1363
|
+
if (typeof value2 === "object") {
|
|
1364
|
+
return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
|
|
1365
|
+
}
|
|
1366
|
+
return void 0;
|
|
1367
|
+
}
|
|
1368
|
+
function quoteString(value2) {
|
|
1369
|
+
const quotes = {
|
|
1370
|
+
"'": 0.1,
|
|
1371
|
+
'"': 0.2
|
|
1372
|
+
};
|
|
1373
|
+
const replacements = {
|
|
1374
|
+
"'": "\\'",
|
|
1375
|
+
'"': '\\"',
|
|
1376
|
+
"\\": "\\\\",
|
|
1377
|
+
"\b": "\\b",
|
|
1378
|
+
"\f": "\\f",
|
|
1379
|
+
"\n": "\\n",
|
|
1380
|
+
"\r": "\\r",
|
|
1381
|
+
" ": "\\t",
|
|
1382
|
+
"\v": "\\v",
|
|
1383
|
+
"\0": "\\0",
|
|
1384
|
+
"\u2028": "\\u2028",
|
|
1385
|
+
"\u2029": "\\u2029"
|
|
1386
|
+
};
|
|
1387
|
+
let product = "";
|
|
1388
|
+
for (let i = 0; i < value2.length; i++) {
|
|
1389
|
+
const c = value2[i];
|
|
1390
|
+
switch (c) {
|
|
1391
|
+
case "'":
|
|
1392
|
+
case '"':
|
|
1393
|
+
quotes[c]++;
|
|
1394
|
+
product += c;
|
|
1395
|
+
continue;
|
|
1396
|
+
case "\0":
|
|
1397
|
+
if (util.isDigit(value2[i + 1])) {
|
|
1398
|
+
product += "\\x00";
|
|
1399
|
+
continue;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
if (replacements[c]) {
|
|
1403
|
+
product += replacements[c];
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1406
|
+
if (c < " ") {
|
|
1407
|
+
let hexString = c.charCodeAt(0).toString(16);
|
|
1408
|
+
product += "\\x" + ("00" + hexString).substring(hexString.length);
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
product += c;
|
|
1412
|
+
}
|
|
1413
|
+
const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
|
|
1414
|
+
product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
|
|
1415
|
+
return quoteChar + product + quoteChar;
|
|
1416
|
+
}
|
|
1417
|
+
function serializeObject(value2) {
|
|
1418
|
+
if (stack.indexOf(value2) >= 0) {
|
|
1419
|
+
throw TypeError("Converting circular structure to JSON5");
|
|
1420
|
+
}
|
|
1421
|
+
stack.push(value2);
|
|
1422
|
+
let stepback = indent;
|
|
1423
|
+
indent = indent + gap;
|
|
1424
|
+
let keys = propertyList || Object.keys(value2);
|
|
1425
|
+
let partial = [];
|
|
1426
|
+
for (const key of keys) {
|
|
1427
|
+
const propertyString = serializeProperty(key, value2);
|
|
1428
|
+
if (propertyString !== void 0) {
|
|
1429
|
+
let member = serializeKey(key) + ":";
|
|
1430
|
+
if (gap !== "") {
|
|
1431
|
+
member += " ";
|
|
1432
|
+
}
|
|
1433
|
+
member += propertyString;
|
|
1434
|
+
partial.push(member);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
let final;
|
|
1438
|
+
if (partial.length === 0) {
|
|
1439
|
+
final = "{}";
|
|
1440
|
+
} else {
|
|
1441
|
+
let properties;
|
|
1442
|
+
if (gap === "") {
|
|
1443
|
+
properties = partial.join(",");
|
|
1444
|
+
final = "{" + properties + "}";
|
|
1445
|
+
} else {
|
|
1446
|
+
let separator = ",\n" + indent;
|
|
1447
|
+
properties = partial.join(separator);
|
|
1448
|
+
final = "{\n" + indent + properties + ",\n" + stepback + "}";
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
stack.pop();
|
|
1452
|
+
indent = stepback;
|
|
1453
|
+
return final;
|
|
1454
|
+
}
|
|
1455
|
+
function serializeKey(key) {
|
|
1456
|
+
if (key.length === 0) {
|
|
1457
|
+
return quoteString(key, true);
|
|
1458
|
+
}
|
|
1459
|
+
const firstChar = String.fromCodePoint(key.codePointAt(0));
|
|
1460
|
+
if (!util.isIdStartChar(firstChar)) {
|
|
1461
|
+
return quoteString(key, true);
|
|
1462
|
+
}
|
|
1463
|
+
for (let i = firstChar.length; i < key.length; i++) {
|
|
1464
|
+
if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
|
|
1465
|
+
return quoteString(key, true);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
return key;
|
|
1469
|
+
}
|
|
1470
|
+
function serializeArray(value2) {
|
|
1471
|
+
if (stack.indexOf(value2) >= 0) {
|
|
1472
|
+
throw TypeError("Converting circular structure to JSON5");
|
|
1473
|
+
}
|
|
1474
|
+
stack.push(value2);
|
|
1475
|
+
let stepback = indent;
|
|
1476
|
+
indent = indent + gap;
|
|
1477
|
+
let partial = [];
|
|
1478
|
+
for (let i = 0; i < value2.length; i++) {
|
|
1479
|
+
const propertyString = serializeProperty(String(i), value2);
|
|
1480
|
+
partial.push(propertyString !== void 0 ? propertyString : "null");
|
|
1481
|
+
}
|
|
1482
|
+
let final;
|
|
1483
|
+
if (partial.length === 0) {
|
|
1484
|
+
final = "[]";
|
|
1485
|
+
} else {
|
|
1486
|
+
if (gap === "") {
|
|
1487
|
+
let properties = partial.join(",");
|
|
1488
|
+
final = "[" + properties + "]";
|
|
1489
|
+
} else {
|
|
1490
|
+
let separator = ",\n" + indent;
|
|
1491
|
+
let properties = partial.join(separator);
|
|
1492
|
+
final = "[\n" + indent + properties + ",\n" + stepback + "]";
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
stack.pop();
|
|
1496
|
+
indent = stepback;
|
|
1497
|
+
return final;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
// ../node_modules/json5/lib/index.js
|
|
1504
|
+
var require_lib = __commonJS({
|
|
1505
|
+
"../node_modules/json5/lib/index.js"(exports2, module2) {
|
|
1506
|
+
var parse = require_parse();
|
|
1507
|
+
var stringify = require_stringify();
|
|
1508
|
+
var JSON5 = {
|
|
1509
|
+
parse,
|
|
1510
|
+
stringify
|
|
1511
|
+
};
|
|
1512
|
+
module2.exports = JSON5;
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
// ../node_modules/strip-bom/index.js
|
|
1517
|
+
var require_strip_bom = __commonJS({
|
|
1518
|
+
"../node_modules/strip-bom/index.js"(exports2, module2) {
|
|
1519
|
+
"use strict";
|
|
1520
|
+
module2.exports = (x) => {
|
|
1521
|
+
if (typeof x !== "string") {
|
|
1522
|
+
throw new TypeError("Expected a string, got " + typeof x);
|
|
1523
|
+
}
|
|
1524
|
+
if (x.charCodeAt(0) === 65279) {
|
|
1525
|
+
return x.slice(1);
|
|
1526
|
+
}
|
|
1527
|
+
return x;
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
// ../node_modules/tsconfig-paths/lib/tsconfig-loader.js
|
|
1533
|
+
var require_tsconfig_loader = __commonJS({
|
|
1534
|
+
"../node_modules/tsconfig-paths/lib/tsconfig-loader.js"(exports2) {
|
|
1535
|
+
"use strict";
|
|
1536
|
+
var __assign = exports2 && exports2.__assign || function() {
|
|
1537
|
+
__assign = Object.assign || function(t) {
|
|
1538
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1539
|
+
s = arguments[i];
|
|
1540
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1541
|
+
t[p] = s[p];
|
|
1542
|
+
}
|
|
1543
|
+
return t;
|
|
1544
|
+
};
|
|
1545
|
+
return __assign.apply(this, arguments);
|
|
1546
|
+
};
|
|
1547
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1548
|
+
exports2.loadTsconfig = exports2.walkForTsConfig = exports2.tsConfigLoader = void 0;
|
|
1549
|
+
var path2 = require("path");
|
|
1550
|
+
var fs = require("fs");
|
|
1551
|
+
var JSON5 = require_lib();
|
|
1552
|
+
var StripBom = require_strip_bom();
|
|
1553
|
+
function tsConfigLoader(_a) {
|
|
1554
|
+
var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
|
|
1555
|
+
var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
|
|
1556
|
+
var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
|
|
1557
|
+
var loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL);
|
|
1558
|
+
return loadResult;
|
|
1559
|
+
}
|
|
1560
|
+
exports2.tsConfigLoader = tsConfigLoader;
|
|
1561
|
+
function loadSyncDefault(cwd, filename, baseUrl) {
|
|
1562
|
+
var configPath = resolveConfigPath(cwd, filename);
|
|
1563
|
+
if (!configPath) {
|
|
1564
|
+
return {
|
|
1565
|
+
tsConfigPath: void 0,
|
|
1566
|
+
baseUrl: void 0,
|
|
1567
|
+
paths: void 0
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
var config = loadTsconfig(configPath);
|
|
1571
|
+
return {
|
|
1572
|
+
tsConfigPath: configPath,
|
|
1573
|
+
baseUrl: baseUrl || config && config.compilerOptions && config.compilerOptions.baseUrl,
|
|
1574
|
+
paths: config && config.compilerOptions && config.compilerOptions.paths
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
function resolveConfigPath(cwd, filename) {
|
|
1578
|
+
if (filename) {
|
|
1579
|
+
var absolutePath = fs.lstatSync(filename).isDirectory() ? path2.resolve(filename, "./tsconfig.json") : path2.resolve(cwd, filename);
|
|
1580
|
+
return absolutePath;
|
|
1581
|
+
}
|
|
1582
|
+
if (fs.statSync(cwd).isFile()) {
|
|
1583
|
+
return path2.resolve(cwd);
|
|
1584
|
+
}
|
|
1585
|
+
var configAbsolutePath = walkForTsConfig(cwd);
|
|
1586
|
+
return configAbsolutePath ? path2.resolve(configAbsolutePath) : void 0;
|
|
1587
|
+
}
|
|
1588
|
+
function walkForTsConfig(directory, readdirSync) {
|
|
1589
|
+
if (readdirSync === void 0) {
|
|
1590
|
+
readdirSync = fs.readdirSync;
|
|
1591
|
+
}
|
|
1592
|
+
var files = readdirSync(directory);
|
|
1593
|
+
var filesToCheck = ["tsconfig.json", "jsconfig.json"];
|
|
1594
|
+
for (var _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
|
|
1595
|
+
var fileToCheck = filesToCheck_1[_i];
|
|
1596
|
+
if (files.indexOf(fileToCheck) !== -1) {
|
|
1597
|
+
return path2.join(directory, fileToCheck);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
var parentDirectory = path2.dirname(directory);
|
|
1601
|
+
if (directory === parentDirectory) {
|
|
1602
|
+
return void 0;
|
|
1603
|
+
}
|
|
1604
|
+
return walkForTsConfig(parentDirectory, readdirSync);
|
|
1605
|
+
}
|
|
1606
|
+
exports2.walkForTsConfig = walkForTsConfig;
|
|
1607
|
+
function loadTsconfig(configFilePath, existsSync, readFileSync) {
|
|
1608
|
+
if (existsSync === void 0) {
|
|
1609
|
+
existsSync = fs.existsSync;
|
|
1610
|
+
}
|
|
1611
|
+
if (readFileSync === void 0) {
|
|
1612
|
+
readFileSync = function(filename) {
|
|
1613
|
+
return fs.readFileSync(filename, "utf8");
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
if (!existsSync(configFilePath)) {
|
|
1617
|
+
return void 0;
|
|
1618
|
+
}
|
|
1619
|
+
var configString = readFileSync(configFilePath);
|
|
1620
|
+
var cleanedJson = StripBom(configString);
|
|
1621
|
+
var config;
|
|
1622
|
+
try {
|
|
1623
|
+
config = JSON5.parse(cleanedJson);
|
|
1624
|
+
} catch (e) {
|
|
1625
|
+
throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
|
|
1626
|
+
}
|
|
1627
|
+
var extendedConfig = config.extends;
|
|
1628
|
+
if (extendedConfig) {
|
|
1629
|
+
var base = void 0;
|
|
1630
|
+
if (Array.isArray(extendedConfig)) {
|
|
1631
|
+
base = extendedConfig.reduce(function(currBase, extendedConfigElement) {
|
|
1632
|
+
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync, readFileSync));
|
|
1633
|
+
}, {});
|
|
1634
|
+
} else {
|
|
1635
|
+
base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync, readFileSync);
|
|
1636
|
+
}
|
|
1637
|
+
return mergeTsconfigs(base, config);
|
|
1638
|
+
}
|
|
1639
|
+
return config;
|
|
1640
|
+
}
|
|
1641
|
+
exports2.loadTsconfig = loadTsconfig;
|
|
1642
|
+
function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync, readFileSync) {
|
|
1643
|
+
var _a;
|
|
1644
|
+
if (typeof extendedConfigValue === "string" && extendedConfigValue.indexOf(".json") === -1) {
|
|
1645
|
+
extendedConfigValue += ".json";
|
|
1646
|
+
}
|
|
1647
|
+
var currentDir = path2.dirname(configFilePath);
|
|
1648
|
+
var extendedConfigPath = path2.join(currentDir, extendedConfigValue);
|
|
1649
|
+
if (extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync(extendedConfigPath)) {
|
|
1650
|
+
extendedConfigPath = path2.join(currentDir, "node_modules", extendedConfigValue);
|
|
1651
|
+
}
|
|
1652
|
+
var config = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
|
|
1653
|
+
if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
|
|
1654
|
+
var extendsDir = path2.dirname(extendedConfigValue);
|
|
1655
|
+
config.compilerOptions.baseUrl = path2.join(extendsDir, config.compilerOptions.baseUrl);
|
|
1656
|
+
}
|
|
1657
|
+
return config;
|
|
1658
|
+
}
|
|
1659
|
+
function mergeTsconfigs(base, config) {
|
|
1660
|
+
base = base || {};
|
|
1661
|
+
config = config || {};
|
|
1662
|
+
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
// ../node_modules/tsconfig-paths/lib/config-loader.js
|
|
1668
|
+
var require_config_loader = __commonJS({
|
|
1669
|
+
"../node_modules/tsconfig-paths/lib/config-loader.js"(exports2) {
|
|
1670
|
+
"use strict";
|
|
1671
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1672
|
+
exports2.configLoader = exports2.loadConfig = void 0;
|
|
1673
|
+
var TsConfigLoader2 = require_tsconfig_loader();
|
|
1674
|
+
var path2 = require("path");
|
|
1675
|
+
function loadConfig2(cwd) {
|
|
1676
|
+
if (cwd === void 0) {
|
|
1677
|
+
cwd = process.cwd();
|
|
1678
|
+
}
|
|
1679
|
+
return configLoader({ cwd });
|
|
1680
|
+
}
|
|
1681
|
+
exports2.loadConfig = loadConfig2;
|
|
1682
|
+
function configLoader(_a) {
|
|
1683
|
+
var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
|
|
1684
|
+
if (explicitParams) {
|
|
1685
|
+
var absoluteBaseUrl = path2.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path2.join(cwd, explicitParams.baseUrl);
|
|
1686
|
+
return {
|
|
1687
|
+
resultType: "success",
|
|
1688
|
+
configFileAbsolutePath: "",
|
|
1689
|
+
baseUrl: explicitParams.baseUrl,
|
|
1690
|
+
absoluteBaseUrl,
|
|
1691
|
+
paths: explicitParams.paths,
|
|
1692
|
+
mainFields: explicitParams.mainFields,
|
|
1693
|
+
addMatchAll: explicitParams.addMatchAll
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
var loadResult = tsConfigLoader({
|
|
1697
|
+
cwd,
|
|
1698
|
+
getEnv: function(key) {
|
|
1699
|
+
return process.env[key];
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
if (!loadResult.tsConfigPath) {
|
|
1703
|
+
return {
|
|
1704
|
+
resultType: "failed",
|
|
1705
|
+
message: "Couldn't find tsconfig.json"
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
return {
|
|
1709
|
+
resultType: "success",
|
|
1710
|
+
configFileAbsolutePath: loadResult.tsConfigPath,
|
|
1711
|
+
baseUrl: loadResult.baseUrl,
|
|
1712
|
+
absoluteBaseUrl: path2.resolve(path2.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
|
|
1713
|
+
paths: loadResult.paths || {},
|
|
1714
|
+
addMatchAll: loadResult.baseUrl !== void 0
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
exports2.configLoader = configLoader;
|
|
1718
|
+
}
|
|
1719
|
+
});
|
|
1720
|
+
|
|
1721
|
+
// ../node_modules/minimist/index.js
|
|
1722
|
+
var require_minimist = __commonJS({
|
|
1723
|
+
"../node_modules/minimist/index.js"(exports2, module2) {
|
|
1724
|
+
module2.exports = function(args, opts) {
|
|
1725
|
+
if (!opts) opts = {};
|
|
1726
|
+
var flags = { bools: {}, strings: {}, unknownFn: null };
|
|
1727
|
+
if (typeof opts["unknown"] === "function") {
|
|
1728
|
+
flags.unknownFn = opts["unknown"];
|
|
1729
|
+
}
|
|
1730
|
+
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
|
|
1731
|
+
flags.allBools = true;
|
|
1732
|
+
} else {
|
|
1733
|
+
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
|
|
1734
|
+
flags.bools[key2] = true;
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
var aliases = {};
|
|
1738
|
+
Object.keys(opts.alias || {}).forEach(function(key2) {
|
|
1739
|
+
aliases[key2] = [].concat(opts.alias[key2]);
|
|
1740
|
+
aliases[key2].forEach(function(x) {
|
|
1741
|
+
aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
|
|
1742
|
+
return x !== y;
|
|
1743
|
+
}));
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
|
|
1747
|
+
flags.strings[key2] = true;
|
|
1748
|
+
if (aliases[key2]) {
|
|
1749
|
+
flags.strings[aliases[key2]] = true;
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
var defaults = opts["default"] || {};
|
|
1753
|
+
var argv = { _: [] };
|
|
1754
|
+
Object.keys(flags.bools).forEach(function(key2) {
|
|
1755
|
+
setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
|
|
1756
|
+
});
|
|
1757
|
+
var notFlags = [];
|
|
1758
|
+
if (args.indexOf("--") !== -1) {
|
|
1759
|
+
notFlags = args.slice(args.indexOf("--") + 1);
|
|
1760
|
+
args = args.slice(0, args.indexOf("--"));
|
|
1761
|
+
}
|
|
1762
|
+
function argDefined(key2, arg2) {
|
|
1763
|
+
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
|
|
1764
|
+
}
|
|
1765
|
+
function setArg(key2, val, arg2) {
|
|
1766
|
+
if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
|
|
1767
|
+
if (flags.unknownFn(arg2) === false) return;
|
|
1768
|
+
}
|
|
1769
|
+
var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
|
|
1770
|
+
setKey(argv, key2.split("."), value2);
|
|
1771
|
+
(aliases[key2] || []).forEach(function(x) {
|
|
1772
|
+
setKey(argv, x.split("."), value2);
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
function setKey(obj, keys, value2) {
|
|
1776
|
+
var o = obj;
|
|
1777
|
+
for (var i2 = 0; i2 < keys.length - 1; i2++) {
|
|
1778
|
+
var key2 = keys[i2];
|
|
1779
|
+
if (isConstructorOrProto(o, key2)) return;
|
|
1780
|
+
if (o[key2] === void 0) o[key2] = {};
|
|
1781
|
+
if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) o[key2] = {};
|
|
1782
|
+
if (o[key2] === Array.prototype) o[key2] = [];
|
|
1783
|
+
o = o[key2];
|
|
1784
|
+
}
|
|
1785
|
+
var key2 = keys[keys.length - 1];
|
|
1786
|
+
if (isConstructorOrProto(o, key2)) return;
|
|
1787
|
+
if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
|
|
1788
|
+
if (o === Array.prototype) o = [];
|
|
1789
|
+
if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
|
|
1790
|
+
o[key2] = value2;
|
|
1791
|
+
} else if (Array.isArray(o[key2])) {
|
|
1792
|
+
o[key2].push(value2);
|
|
1793
|
+
} else {
|
|
1794
|
+
o[key2] = [o[key2], value2];
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
function aliasIsBoolean(key2) {
|
|
1798
|
+
return aliases[key2].some(function(x) {
|
|
1799
|
+
return flags.bools[x];
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
for (var i = 0; i < args.length; i++) {
|
|
1803
|
+
var arg = args[i];
|
|
1804
|
+
if (/^--.+=/.test(arg)) {
|
|
1805
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
1806
|
+
var key = m[1];
|
|
1807
|
+
var value = m[2];
|
|
1808
|
+
if (flags.bools[key]) {
|
|
1809
|
+
value = value !== "false";
|
|
1810
|
+
}
|
|
1811
|
+
setArg(key, value, arg);
|
|
1812
|
+
} else if (/^--no-.+/.test(arg)) {
|
|
1813
|
+
var key = arg.match(/^--no-(.+)/)[1];
|
|
1814
|
+
setArg(key, false, arg);
|
|
1815
|
+
} else if (/^--.+/.test(arg)) {
|
|
1816
|
+
var key = arg.match(/^--(.+)/)[1];
|
|
1817
|
+
var next = args[i + 1];
|
|
1818
|
+
if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
1819
|
+
setArg(key, next, arg);
|
|
1820
|
+
i++;
|
|
1821
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
1822
|
+
setArg(key, next === "true", arg);
|
|
1823
|
+
i++;
|
|
1824
|
+
} else {
|
|
1825
|
+
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
1826
|
+
}
|
|
1827
|
+
} else if (/^-[^-]+/.test(arg)) {
|
|
1828
|
+
var letters = arg.slice(1, -1).split("");
|
|
1829
|
+
var broken = false;
|
|
1830
|
+
for (var j = 0; j < letters.length; j++) {
|
|
1831
|
+
var next = arg.slice(j + 2);
|
|
1832
|
+
if (next === "-") {
|
|
1833
|
+
setArg(letters[j], next, arg);
|
|
1834
|
+
continue;
|
|
1835
|
+
}
|
|
1836
|
+
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
|
1837
|
+
setArg(letters[j], next.split("=")[1], arg);
|
|
1838
|
+
broken = true;
|
|
1839
|
+
break;
|
|
1840
|
+
}
|
|
1841
|
+
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
1842
|
+
setArg(letters[j], next, arg);
|
|
1843
|
+
broken = true;
|
|
1844
|
+
break;
|
|
1845
|
+
}
|
|
1846
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
1847
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
1848
|
+
broken = true;
|
|
1849
|
+
break;
|
|
1850
|
+
} else {
|
|
1851
|
+
setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
var key = arg.slice(-1)[0];
|
|
1855
|
+
if (!broken && key !== "-") {
|
|
1856
|
+
if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
1857
|
+
setArg(key, args[i + 1], arg);
|
|
1858
|
+
i++;
|
|
1859
|
+
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
|
|
1860
|
+
setArg(key, args[i + 1] === "true", arg);
|
|
1861
|
+
i++;
|
|
1862
|
+
} else {
|
|
1863
|
+
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
} else {
|
|
1867
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
1868
|
+
argv._.push(
|
|
1869
|
+
flags.strings["_"] || !isNumber(arg) ? arg : Number(arg)
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
if (opts.stopEarly) {
|
|
1873
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
Object.keys(defaults).forEach(function(key2) {
|
|
1879
|
+
if (!hasKey(argv, key2.split("."))) {
|
|
1880
|
+
setKey(argv, key2.split("."), defaults[key2]);
|
|
1881
|
+
(aliases[key2] || []).forEach(function(x) {
|
|
1882
|
+
setKey(argv, x.split("."), defaults[key2]);
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
});
|
|
1886
|
+
if (opts["--"]) {
|
|
1887
|
+
argv["--"] = new Array();
|
|
1888
|
+
notFlags.forEach(function(key2) {
|
|
1889
|
+
argv["--"].push(key2);
|
|
1890
|
+
});
|
|
1891
|
+
} else {
|
|
1892
|
+
notFlags.forEach(function(key2) {
|
|
1893
|
+
argv._.push(key2);
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
return argv;
|
|
1897
|
+
};
|
|
1898
|
+
function hasKey(obj, keys) {
|
|
1899
|
+
var o = obj;
|
|
1900
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
1901
|
+
o = o[key2] || {};
|
|
1902
|
+
});
|
|
1903
|
+
var key = keys[keys.length - 1];
|
|
1904
|
+
return key in o;
|
|
1905
|
+
}
|
|
1906
|
+
function isNumber(x) {
|
|
1907
|
+
if (typeof x === "number") return true;
|
|
1908
|
+
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
|
1909
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
1910
|
+
}
|
|
1911
|
+
function isConstructorOrProto(obj, key) {
|
|
1912
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
|
|
1917
|
+
// ../node_modules/tsconfig-paths/lib/register.js
|
|
1918
|
+
var require_register = __commonJS({
|
|
1919
|
+
"../node_modules/tsconfig-paths/lib/register.js"(exports2) {
|
|
1920
|
+
"use strict";
|
|
1921
|
+
var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) {
|
|
1922
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1923
|
+
if (ar || !(i in from)) {
|
|
1924
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1925
|
+
ar[i] = from[i];
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1929
|
+
};
|
|
1930
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1931
|
+
exports2.register = void 0;
|
|
1932
|
+
var match_path_sync_1 = require_match_path_sync();
|
|
1933
|
+
var config_loader_1 = require_config_loader();
|
|
1934
|
+
var noOp = function() {
|
|
1935
|
+
return void 0;
|
|
1936
|
+
};
|
|
1937
|
+
function getCoreModules(builtinModules) {
|
|
1938
|
+
builtinModules = builtinModules || [
|
|
1939
|
+
"assert",
|
|
1940
|
+
"buffer",
|
|
1941
|
+
"child_process",
|
|
1942
|
+
"cluster",
|
|
1943
|
+
"crypto",
|
|
1944
|
+
"dgram",
|
|
1945
|
+
"dns",
|
|
1946
|
+
"domain",
|
|
1947
|
+
"events",
|
|
1948
|
+
"fs",
|
|
1949
|
+
"http",
|
|
1950
|
+
"https",
|
|
1951
|
+
"net",
|
|
1952
|
+
"os",
|
|
1953
|
+
"path",
|
|
1954
|
+
"punycode",
|
|
1955
|
+
"querystring",
|
|
1956
|
+
"readline",
|
|
1957
|
+
"stream",
|
|
1958
|
+
"string_decoder",
|
|
1959
|
+
"tls",
|
|
1960
|
+
"tty",
|
|
1961
|
+
"url",
|
|
1962
|
+
"util",
|
|
1963
|
+
"v8",
|
|
1964
|
+
"vm",
|
|
1965
|
+
"zlib"
|
|
1966
|
+
];
|
|
1967
|
+
var coreModules = {};
|
|
1968
|
+
for (var _i = 0, builtinModules_1 = builtinModules; _i < builtinModules_1.length; _i++) {
|
|
1969
|
+
var module_1 = builtinModules_1[_i];
|
|
1970
|
+
coreModules[module_1] = true;
|
|
1971
|
+
}
|
|
1972
|
+
return coreModules;
|
|
1973
|
+
}
|
|
1974
|
+
function register(params) {
|
|
1975
|
+
var cwd;
|
|
1976
|
+
var explicitParams;
|
|
1977
|
+
if (params) {
|
|
1978
|
+
cwd = params.cwd;
|
|
1979
|
+
if (params.baseUrl || params.paths) {
|
|
1980
|
+
explicitParams = params;
|
|
1981
|
+
}
|
|
1982
|
+
} else {
|
|
1983
|
+
var minimist = require_minimist();
|
|
1984
|
+
var argv = minimist(process.argv.slice(2), {
|
|
1985
|
+
// eslint-disable-next-line id-denylist
|
|
1986
|
+
string: ["project"],
|
|
1987
|
+
alias: {
|
|
1988
|
+
project: ["P"]
|
|
1989
|
+
}
|
|
1990
|
+
});
|
|
1991
|
+
cwd = argv.project;
|
|
1992
|
+
}
|
|
1993
|
+
var configLoaderResult = (0, config_loader_1.configLoader)({
|
|
1994
|
+
cwd: cwd !== null && cwd !== void 0 ? cwd : process.cwd(),
|
|
1995
|
+
explicitParams
|
|
1996
|
+
});
|
|
1997
|
+
if (configLoaderResult.resultType === "failed") {
|
|
1998
|
+
console.warn("".concat(configLoaderResult.message, ". tsconfig-paths will be skipped"));
|
|
1999
|
+
return noOp;
|
|
2000
|
+
}
|
|
2001
|
+
var matchPath = (0, match_path_sync_1.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
|
|
2002
|
+
var Module = require("module");
|
|
2003
|
+
var originalResolveFilename = Module._resolveFilename;
|
|
2004
|
+
var coreModules = getCoreModules(Module.builtinModules);
|
|
2005
|
+
Module._resolveFilename = function(request, _parent) {
|
|
2006
|
+
var isCoreModule = coreModules.hasOwnProperty(request);
|
|
2007
|
+
if (!isCoreModule) {
|
|
2008
|
+
var found = matchPath(request);
|
|
2009
|
+
if (found) {
|
|
2010
|
+
var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true);
|
|
2011
|
+
return originalResolveFilename.apply(this, modifiedArguments);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
return originalResolveFilename.apply(this, arguments);
|
|
2015
|
+
};
|
|
2016
|
+
return function() {
|
|
2017
|
+
Module._resolveFilename = originalResolveFilename;
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
exports2.register = register;
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
2023
|
+
|
|
2024
|
+
// ../node_modules/tsconfig-paths/lib/index.js
|
|
2025
|
+
var require_lib2 = __commonJS({
|
|
2026
|
+
"../node_modules/tsconfig-paths/lib/index.js"(exports2) {
|
|
2027
|
+
"use strict";
|
|
2028
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2029
|
+
exports2.loadConfig = exports2.register = exports2.matchFromAbsolutePathsAsync = exports2.createMatchPathAsync = exports2.matchFromAbsolutePaths = exports2.createMatchPath = void 0;
|
|
2030
|
+
var match_path_sync_1 = require_match_path_sync();
|
|
2031
|
+
Object.defineProperty(exports2, "createMatchPath", { enumerable: true, get: function() {
|
|
2032
|
+
return match_path_sync_1.createMatchPath;
|
|
2033
|
+
} });
|
|
2034
|
+
Object.defineProperty(exports2, "matchFromAbsolutePaths", { enumerable: true, get: function() {
|
|
2035
|
+
return match_path_sync_1.matchFromAbsolutePaths;
|
|
2036
|
+
} });
|
|
2037
|
+
var match_path_async_1 = require_match_path_async();
|
|
2038
|
+
Object.defineProperty(exports2, "createMatchPathAsync", { enumerable: true, get: function() {
|
|
2039
|
+
return match_path_async_1.createMatchPathAsync;
|
|
2040
|
+
} });
|
|
2041
|
+
Object.defineProperty(exports2, "matchFromAbsolutePathsAsync", { enumerable: true, get: function() {
|
|
2042
|
+
return match_path_async_1.matchFromAbsolutePathsAsync;
|
|
2043
|
+
} });
|
|
2044
|
+
var register_1 = require_register();
|
|
2045
|
+
Object.defineProperty(exports2, "register", { enumerable: true, get: function() {
|
|
2046
|
+
return register_1.register;
|
|
2047
|
+
} });
|
|
2048
|
+
var config_loader_1 = require_config_loader();
|
|
2049
|
+
Object.defineProperty(exports2, "loadConfig", { enumerable: true, get: function() {
|
|
2050
|
+
return config_loader_1.loadConfig;
|
|
2051
|
+
} });
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
|
|
2055
|
+
// src/transpilers/esm/esbuild-transpiler.mjs
|
|
2056
|
+
var esbuild_transpiler_exports = {};
|
|
2057
|
+
__export(esbuild_transpiler_exports, {
|
|
2058
|
+
create: () => create,
|
|
2059
|
+
default: () => esbuild_transpiler_default
|
|
2060
|
+
});
|
|
2061
|
+
module.exports = __toCommonJS(esbuild_transpiler_exports);
|
|
2062
|
+
|
|
2063
|
+
// src/transpilers/esm/esbuild.mjs
|
|
2064
|
+
var import_esbuild = require("esbuild");
|
|
2065
|
+
var import_path = __toESM(require("path"), 1);
|
|
2066
|
+
var import_tsconfig_paths = __toESM(require_lib2(), 1);
|
|
2067
|
+
var import_url = require("url");
|
|
2068
|
+
var defaultOptions = {
|
|
2069
|
+
debug: true
|
|
2070
|
+
};
|
|
2071
|
+
var tsconfigCache = null;
|
|
2072
|
+
function loadTsConfigPaths() {
|
|
2073
|
+
if (tsconfigCache) return tsconfigCache;
|
|
2074
|
+
try {
|
|
2075
|
+
const configLoaderResult = (0, import_tsconfig_paths.loadConfig)(process.cwd());
|
|
2076
|
+
if (configLoaderResult.resultType === "success") {
|
|
2077
|
+
tsconfigCache = {
|
|
2078
|
+
absoluteBaseUrl: configLoaderResult.absoluteBaseUrl,
|
|
2079
|
+
paths: configLoaderResult.paths
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
} catch (error) {
|
|
2083
|
+
console.error("Failed to load tsconfig for aliases:", error);
|
|
2084
|
+
}
|
|
2085
|
+
return tsconfigCache || { paths: {} };
|
|
2086
|
+
}
|
|
2087
|
+
function rewritePathMappings(code) {
|
|
2088
|
+
const { absoluteBaseUrl, paths } = loadTsConfigPaths();
|
|
2089
|
+
if (!paths || !absoluteBaseUrl) return code;
|
|
2090
|
+
let modifiedCode = code;
|
|
2091
|
+
for (const [pattern, replacements] of Object.entries(paths)) {
|
|
2092
|
+
const searchPattern = pattern.replace("/*", "");
|
|
2093
|
+
const replacementPath = replacements[0].replace("/*", "");
|
|
2094
|
+
const regex = new RegExp(`(from\\s+['"])${searchPattern}(/[^'"]+)?(['"])`, "g");
|
|
2095
|
+
modifiedCode = modifiedCode.replace(regex, (match, prefix, subPath, suffix) => {
|
|
2096
|
+
const pathSuffix = subPath ? subPath.substring(1) : "";
|
|
2097
|
+
const absolutePath = import_path.default.resolve(absoluteBaseUrl, replacementPath, pathSuffix);
|
|
2098
|
+
const fileUrl = (0, import_url.pathToFileURL)(absolutePath).href;
|
|
2099
|
+
return `${prefix}${fileUrl}${suffix}`;
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2102
|
+
return modifiedCode;
|
|
2103
|
+
}
|
|
2104
|
+
var commonOptions = {
|
|
2105
|
+
format: "esm",
|
|
2106
|
+
logLevel: "info",
|
|
2107
|
+
target: ["es2022"],
|
|
2108
|
+
minify: false,
|
|
2109
|
+
sourcemap: "external",
|
|
2110
|
+
platform: "node"
|
|
2111
|
+
};
|
|
2112
|
+
if (process.env.CUCUMBER_EXPERIMENTAL_DECORATORS === "true") {
|
|
2113
|
+
commonOptions.tsconfigRaw = {
|
|
2114
|
+
compilerOptions: {
|
|
2115
|
+
experimentalDecorators: true,
|
|
2116
|
+
importsNotUsedAsValues: "remove",
|
|
2117
|
+
strict: true
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
} else {
|
|
2121
|
+
commonOptions.tsconfigRaw = {
|
|
2122
|
+
compilerOptions: {
|
|
2123
|
+
importsNotUsedAsValues: "remove",
|
|
2124
|
+
strict: true
|
|
2125
|
+
}
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2128
|
+
var loaders = {
|
|
2129
|
+
".js": "js",
|
|
2130
|
+
".mjs": "js",
|
|
2131
|
+
".cjs": "js",
|
|
2132
|
+
".jsx": "jsx",
|
|
2133
|
+
".ts": "ts",
|
|
2134
|
+
".tsx": "tsx",
|
|
2135
|
+
".json": "json"
|
|
2136
|
+
};
|
|
2137
|
+
var getLoaders = (options) => {
|
|
2138
|
+
const ret = { ...loaders };
|
|
2139
|
+
if (typeof options.esbuild?.loader === "object") {
|
|
2140
|
+
for (const [e, l] of Object.entries(options.esbuild.loader)) ret[e] = l;
|
|
2141
|
+
}
|
|
2142
|
+
return ret;
|
|
2143
|
+
};
|
|
2144
|
+
var transpileCode = (code, filename, ext, _options) => {
|
|
2145
|
+
const options = { ...defaultOptions, ..._options };
|
|
2146
|
+
const loadersMap = getLoaders(options);
|
|
2147
|
+
const loaderExt = ext != void 0 ? ext : import_path.default.extname(filename);
|
|
2148
|
+
let processedCode = rewritePathMappings(code);
|
|
2149
|
+
const ret = (0, import_esbuild.transformSync)(processedCode, {
|
|
2150
|
+
...commonOptions,
|
|
2151
|
+
...options.esbuild || {},
|
|
2152
|
+
loader: loadersMap[loaderExt],
|
|
2153
|
+
sourcefile: filename
|
|
2154
|
+
});
|
|
2155
|
+
return { output: ret.code, sourceMap: ret.map };
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
// src/transpilers/esm/esbuild-transpiler.mjs
|
|
2159
|
+
function create(_createOptions) {
|
|
2160
|
+
return {
|
|
2161
|
+
transpile(input, options) {
|
|
2162
|
+
const result = transpileCode(input, options.fileName);
|
|
2163
|
+
return {
|
|
2164
|
+
outputText: result.output,
|
|
2165
|
+
sourceMapText: result.sourceMap
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
var esbuild_transpiler_default = { create };
|
|
2171
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2172
|
+
0 && (module.exports = {
|
|
2173
|
+
create
|
|
2174
|
+
});
|