adnbn 0.0.18 → 0.0.20

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.
@@ -2,12 +2,12 @@
2
2
 
3
3
  var cac = require('cac');
4
4
  var webpack = require('webpack');
5
- var path2 = require('path');
6
5
  var fs = require('fs');
7
6
  var c12 = require('c12');
8
7
  var VirtualModulesPlugin = require('webpack-virtual-modules');
9
8
  var _ = require('lodash');
10
- var ts = require('typescript');
9
+ var path = require('path');
10
+ var ts2 = require('typescript');
11
11
  var TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
12
12
  var MiniCssExtractPlugin = require('mini-css-extract-plugin');
13
13
 
@@ -15,11 +15,11 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
16
16
  var cac__default = /*#__PURE__*/_interopDefault(cac);
17
17
  var webpack__default = /*#__PURE__*/_interopDefault(webpack);
18
- var path2__default = /*#__PURE__*/_interopDefault(path2);
19
18
  var fs__default = /*#__PURE__*/_interopDefault(fs);
20
19
  var VirtualModulesPlugin__default = /*#__PURE__*/_interopDefault(VirtualModulesPlugin);
21
20
  var ___default = /*#__PURE__*/_interopDefault(_);
22
- var ts__default = /*#__PURE__*/_interopDefault(ts);
21
+ var path__default = /*#__PURE__*/_interopDefault(path);
22
+ var ts2__default = /*#__PURE__*/_interopDefault(ts2);
23
23
  var TsconfigPathsPlugin__default = /*#__PURE__*/_interopDefault(TsconfigPathsPlugin);
24
24
  var MiniCssExtractPlugin__default = /*#__PURE__*/_interopDefault(MiniCssExtractPlugin);
25
25
 
@@ -35,14 +35,21 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
35
35
  if (typeof require !== "undefined") return require.apply(this, arguments);
36
36
  throw Error('Dynamic require of "' + x + '" is not supported');
37
37
  });
38
+ var __esm = (fn, res) => function __init() {
39
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
40
+ };
38
41
  var __commonJS = (cb, mod) => function __require2() {
39
42
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
40
43
  };
44
+ var __export = (target, all) => {
45
+ for (var name2 in all)
46
+ __defProp(target, name2, { get: all[name2], enumerable: true });
47
+ };
41
48
  var __copyProps = (to, from, except, desc) => {
42
49
  if (from && typeof from === "object" || typeof from === "function") {
43
- for (let key of __getOwnPropNames(from))
44
- if (!__hasOwnProp.call(to, key) && key !== except)
45
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
50
+ for (let key2 of __getOwnPropNames(from))
51
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
52
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
46
53
  }
47
54
  return to;
48
55
  };
@@ -54,6 +61,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
54
61
  !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
62
  mod
56
63
  ));
64
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
65
 
58
66
  // node_modules/dotenv/package.json
59
67
  var require_package = __commonJS({
@@ -125,20 +133,20 @@ var require_package = __commonJS({
125
133
  // node_modules/dotenv/lib/main.js
126
134
  var require_main = __commonJS({
127
135
  "node_modules/dotenv/lib/main.js"(exports, module) {
128
- var fs2 = __require("fs");
136
+ var fs3 = __require("fs");
129
137
  var path7 = __require("path");
130
138
  var os = __require("os");
131
139
  var crypto = __require("crypto");
132
140
  var packageJson = require_package();
133
141
  var version2 = packageJson.version;
134
142
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
135
- function parse(src) {
143
+ function parse3(src) {
136
144
  const obj = {};
137
145
  let lines = src.toString();
138
146
  lines = lines.replace(/\r\n?/mg, "\n");
139
147
  let match;
140
148
  while ((match = LINE.exec(lines)) != null) {
141
- const key = match[1];
149
+ const key2 = match[1];
142
150
  let value = match[2] || "";
143
151
  value = value.trim();
144
152
  const maybeQuote = value[0];
@@ -147,7 +155,7 @@ var require_main = __commonJS({
147
155
  value = value.replace(/\\n/g, "\n");
148
156
  value = value.replace(/\\r/g, "\r");
149
157
  }
150
- obj[key] = value;
158
+ obj[key2] = value;
151
159
  }
152
160
  return obj;
153
161
  }
@@ -164,8 +172,8 @@ var require_main = __commonJS({
164
172
  let decrypted;
165
173
  for (let i = 0; i < length; i++) {
166
174
  try {
167
- const key = keys[i].trim();
168
- const attrs = _instructions(result, key);
175
+ const key2 = keys[i].trim();
176
+ const attrs = _instructions(result, key2);
169
177
  decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
170
178
  break;
171
179
  } catch (error) {
@@ -206,8 +214,8 @@ var require_main = __commonJS({
206
214
  }
207
215
  throw error;
208
216
  }
209
- const key = uri.password;
210
- if (!key) {
217
+ const key2 = uri.password;
218
+ if (!key2) {
211
219
  const err = new Error("INVALID_DOTENV_KEY: Missing key part");
212
220
  err.code = "INVALID_DOTENV_KEY";
213
221
  throw err;
@@ -225,14 +233,14 @@ var require_main = __commonJS({
225
233
  err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
226
234
  throw err;
227
235
  }
228
- return { ciphertext, key };
236
+ return { ciphertext, key: key2 };
229
237
  }
230
238
  function _vaultPath(options) {
231
239
  let possibleVaultPath = null;
232
240
  if (options && options.path && options.path.length > 0) {
233
241
  if (Array.isArray(options.path)) {
234
242
  for (const filepath of options.path) {
235
- if (fs2.existsSync(filepath)) {
243
+ if (fs3.existsSync(filepath)) {
236
244
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
237
245
  }
238
246
  }
@@ -242,7 +250,7 @@ var require_main = __commonJS({
242
250
  } else {
243
251
  possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
244
252
  }
245
- if (fs2.existsSync(possibleVaultPath)) {
253
+ if (fs3.existsSync(possibleVaultPath)) {
246
254
  return possibleVaultPath;
247
255
  }
248
256
  return null;
@@ -286,7 +294,7 @@ var require_main = __commonJS({
286
294
  const parsedAll = {};
287
295
  for (const path8 of optionPaths) {
288
296
  try {
289
- const parsed = DotenvModule.parse(fs2.readFileSync(path8, { encoding }));
297
+ const parsed = DotenvModule.parse(fs3.readFileSync(path8, { encoding }));
290
298
  DotenvModule.populate(parsedAll, parsed, options);
291
299
  } catch (e) {
292
300
  if (debug) {
@@ -318,13 +326,13 @@ var require_main = __commonJS({
318
326
  return DotenvModule._configVault(options);
319
327
  }
320
328
  function decrypt(encrypted, keyStr) {
321
- const key = Buffer.from(keyStr.slice(-64), "hex");
329
+ const key2 = Buffer.from(keyStr.slice(-64), "hex");
322
330
  let ciphertext = Buffer.from(encrypted, "base64");
323
331
  const nonce = ciphertext.subarray(0, 12);
324
332
  const authTag = ciphertext.subarray(-16);
325
333
  ciphertext = ciphertext.subarray(12, -16);
326
334
  try {
327
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
335
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key2, nonce);
328
336
  aesgcm.setAuthTag(authTag);
329
337
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
330
338
  } catch (error) {
@@ -352,20 +360,20 @@ var require_main = __commonJS({
352
360
  err.code = "OBJECT_REQUIRED";
353
361
  throw err;
354
362
  }
355
- for (const key of Object.keys(parsed)) {
356
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
363
+ for (const key2 of Object.keys(parsed)) {
364
+ if (Object.prototype.hasOwnProperty.call(processEnv, key2)) {
357
365
  if (override === true) {
358
- processEnv[key] = parsed[key];
366
+ processEnv[key2] = parsed[key2];
359
367
  }
360
368
  if (debug) {
361
369
  if (override === true) {
362
- _debug(`"${key}" is already defined and WAS overwritten`);
370
+ _debug(`"${key2}" is already defined and WAS overwritten`);
363
371
  } else {
364
- _debug(`"${key}" is already defined and was NOT overwritten`);
372
+ _debug(`"${key2}" is already defined and was NOT overwritten`);
365
373
  }
366
374
  }
367
375
  } else {
368
- processEnv[key] = parsed[key];
376
+ processEnv[key2] = parsed[key2];
369
377
  }
370
378
  }
371
379
  }
@@ -375,7 +383,7 @@ var require_main = __commonJS({
375
383
  _parseVault,
376
384
  config,
377
385
  decrypt,
378
- parse,
386
+ parse: parse3,
379
387
  populate
380
388
  };
381
389
  module.exports.configDotenv = DotenvModule.configDotenv;
@@ -430,9 +438,9 @@ var require_wildcard = __commonJS({
430
438
  }
431
439
  } else if (typeof input == "object") {
432
440
  matches = {};
433
- for (var key in input) {
434
- if (this.match(key)) {
435
- matches[key] = input[key];
441
+ for (var key2 in input) {
442
+ if (this.match(key2)) {
443
+ matches[key2] = input[key2];
436
444
  }
437
445
  }
438
446
  }
@@ -591,8 +599,8 @@ var require_kind_of = __commonJS({
591
599
  if (val instanceof RegExp) return true;
592
600
  return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
593
601
  }
594
- function isGeneratorFn(name, val) {
595
- return ctorName(name) === "GeneratorFunction";
602
+ function isGeneratorFn(name2, val) {
603
+ return ctorName(name2) === "GeneratorFunction";
596
604
  }
597
605
  function isGeneratorObj(val) {
598
606
  return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
@@ -741,8 +749,8 @@ var require_clone_deep = __commonJS({
741
749
  }
742
750
  if (instanceClone || isPlainObject(val)) {
743
751
  const res = new val.constructor();
744
- for (let key in val) {
745
- res[key] = cloneDeep(val[key], instanceClone);
752
+ for (let key2 in val) {
753
+ res[key2] = cloneDeep(val[key2], instanceClone);
746
754
  }
747
755
  return res;
748
756
  }
@@ -768,8 +776,8 @@ var require_flat = __commonJS({
768
776
  function isBuffer(obj) {
769
777
  return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
770
778
  }
771
- function keyIdentity(key) {
772
- return key;
779
+ function keyIdentity(key2) {
780
+ return key2;
773
781
  }
774
782
  function flatten(target, opts) {
775
783
  opts = opts || {};
@@ -779,13 +787,13 @@ var require_flat = __commonJS({
779
787
  const output = {};
780
788
  function step(object, prev, currentDepth) {
781
789
  currentDepth = currentDepth || 1;
782
- Object.keys(object).forEach(function(key) {
783
- const value = object[key];
790
+ Object.keys(object).forEach(function(key2) {
791
+ const value = object[key2];
784
792
  const isarray = opts.safe && Array.isArray(value);
785
793
  const type = Object.prototype.toString.call(value);
786
794
  const isbuffer = isBuffer(value);
787
795
  const isobject = type === "[object Object]" || type === "[object Array]";
788
- const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
796
+ const newKey = prev ? prev + delimiter + transformKey(key2) : transformKey(key2);
789
797
  if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
790
798
  return step(value, newKey, currentDepth + 1);
791
799
  }
@@ -805,13 +813,13 @@ var require_flat = __commonJS({
805
813
  if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
806
814
  return target;
807
815
  }
808
- function getkey(key) {
809
- const parsedKey = Number(key);
810
- return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
816
+ function getkey(key2) {
817
+ const parsedKey = Number(key2);
818
+ return isNaN(parsedKey) || key2.indexOf(".") !== -1 || opts.object ? key2 : parsedKey;
811
819
  }
812
820
  function addKeys(keyPrefix, recipient, target2) {
813
- return Object.keys(target2).reduce(function(result2, key) {
814
- result2[keyPrefix + delimiter + key] = target2[key];
821
+ return Object.keys(target2).reduce(function(result2, key2) {
822
+ result2[keyPrefix + delimiter + key2] = target2[key2];
815
823
  return result2;
816
824
  }, recipient);
817
825
  }
@@ -827,26 +835,26 @@ var require_flat = __commonJS({
827
835
  return !Object.keys(val).length;
828
836
  }
829
837
  }
830
- target = Object.keys(target).reduce(function(result2, key) {
831
- const type = Object.prototype.toString.call(target[key]);
838
+ target = Object.keys(target).reduce(function(result2, key2) {
839
+ const type = Object.prototype.toString.call(target[key2]);
832
840
  const isObject = type === "[object Object]" || type === "[object Array]";
833
- if (!isObject || isEmpty(target[key])) {
834
- result2[key] = target[key];
841
+ if (!isObject || isEmpty(target[key2])) {
842
+ result2[key2] = target[key2];
835
843
  return result2;
836
844
  } else {
837
845
  return addKeys(
838
- key,
846
+ key2,
839
847
  result2,
840
- flatten(target[key], opts)
848
+ flatten(target[key2], opts)
841
849
  );
842
850
  }
843
851
  }, {});
844
- Object.keys(target).forEach(function(key) {
845
- const split = key.split(delimiter).map(transformKey);
852
+ Object.keys(target).forEach(function(key2) {
853
+ const split = key2.split(delimiter).map(transformKey);
846
854
  let key1 = getkey(split.shift());
847
- let key2 = getkey(split[0]);
855
+ let key22 = getkey(split[0]);
848
856
  let recipient = result;
849
- while (key2 !== void 0) {
857
+ while (key22 !== void 0) {
850
858
  if (key1 === "__proto__") {
851
859
  return;
852
860
  }
@@ -856,15 +864,15 @@ var require_flat = __commonJS({
856
864
  return;
857
865
  }
858
866
  if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
859
- recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
867
+ recipient[key1] = typeof key22 === "number" && !opts.object ? [] : {};
860
868
  }
861
869
  recipient = recipient[key1];
862
870
  if (split.length > 0) {
863
871
  key1 = getkey(split.shift());
864
- key2 = getkey(split[0]);
872
+ key22 = getkey(split[0]);
865
873
  }
866
874
  }
867
- recipient[key1] = unflatten(target[key], opts);
875
+ recipient[key1] = unflatten(target[key2], opts);
868
876
  });
869
877
  return result;
870
878
  }
@@ -997,9 +1005,9 @@ var require_join_arrays = __commonJS({
997
1005
  var utils_1 = require_utils();
998
1006
  var isArray = Array.isArray;
999
1007
  function joinArrays(_a) {
1000
- var _b = _a === void 0 ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key = _b.key;
1008
+ var _b = _a === void 0 ? {} : _a, customizeArray = _b.customizeArray, customizeObject = _b.customizeObject, key2 = _b.key;
1001
1009
  return function _joinArrays(a, b, k) {
1002
- var newKey = key ? "".concat(key, ".").concat(k) : k;
1010
+ var newKey = key2 ? "".concat(key2, ".").concat(k) : k;
1003
1011
  if ((0, utils_1.isFunction)(a) && (0, utils_1.isFunction)(b)) {
1004
1012
  return function() {
1005
1013
  var args = [];
@@ -1067,21 +1075,21 @@ var require_unique = __commonJS({
1067
1075
  return to.concat(ar || Array.prototype.slice.call(from));
1068
1076
  };
1069
1077
  Object.defineProperty(exports, "__esModule", { value: true });
1070
- function mergeUnique(key, uniques, getter) {
1078
+ function mergeUnique(key2, uniques, getter) {
1071
1079
  var uniquesSet = new Set(uniques);
1072
1080
  return function(a, b, k) {
1073
- return k === key && Array.from(__spreadArray(__spreadArray([], __read(a), false), __read(b), false).map(function(it) {
1081
+ return k === key2 && Array.from(__spreadArray(__spreadArray([], __read(a), false), __read(b), false).map(function(it) {
1074
1082
  return { key: getter(it), value: it };
1075
1083
  }).map(function(_a) {
1076
- var key2 = _a.key, value = _a.value;
1084
+ var key3 = _a.key, value = _a.value;
1077
1085
  return {
1078
- key: uniquesSet.has(key2) ? key2 : value,
1086
+ key: uniquesSet.has(key3) ? key3 : value,
1079
1087
  value
1080
1088
  };
1081
1089
  }).reduce(function(m, _a) {
1082
- var key2 = _a.key, value = _a.value;
1083
- m.delete(key2);
1084
- return m.set(key2, value);
1090
+ var key3 = _a.key, value = _a.value;
1091
+ m.delete(key3);
1092
+ return m.set(key3, value);
1085
1093
  }, /* @__PURE__ */ new Map()).values());
1086
1094
  };
1087
1095
  }
@@ -1193,9 +1201,9 @@ var require_dist = __commonJS({
1193
1201
  }
1194
1202
  exports.mergeWithCustomize = mergeWithCustomize2;
1195
1203
  function customizeArray(rules) {
1196
- return function(a, b, key) {
1204
+ return function(a, b, key2) {
1197
1205
  var matchedRule = Object.keys(rules).find(function(rule) {
1198
- return (0, wildcard_1.default)(rule, key);
1206
+ return (0, wildcard_1.default)(rule, key2);
1199
1207
  }) || "";
1200
1208
  if (matchedRule) {
1201
1209
  switch (rules[matchedRule]) {
@@ -1213,9 +1221,9 @@ var require_dist = __commonJS({
1213
1221
  exports.customizeArray = customizeArray;
1214
1222
  function mergeWithRules(rules) {
1215
1223
  return mergeWithCustomize2({
1216
- customizeArray: function(a, b, key) {
1224
+ customizeArray: function(a, b, key2) {
1217
1225
  var currentRule = rules;
1218
- key.split(".").forEach(function(k) {
1226
+ key2.split(".").forEach(function(k) {
1219
1227
  if (!currentRule) {
1220
1228
  return;
1221
1229
  }
@@ -1351,8 +1359,8 @@ var require_dist = __commonJS({
1351
1359
  return arr[arr.length - 1];
1352
1360
  }
1353
1361
  function customizeObject(rules) {
1354
- return function(a, b, key) {
1355
- switch (rules[key]) {
1362
+ return function(a, b, key2) {
1363
+ switch (rules[key2]) {
1356
1364
  case types_1.CustomizeRule.Prepend:
1357
1365
  return (0, merge_with_1.default)([b, a], (0, join_arrays_1.default)());
1358
1366
  case types_1.CustomizeRule.Replace:
@@ -1366,280 +1374,2401 @@ var require_dist = __commonJS({
1366
1374
  }
1367
1375
  });
1368
1376
 
1369
- // src/cli/builders/app/command.ts
1370
- var build = (compiler) => {
1371
- compiler.run((err, stats) => {
1372
- if (err) {
1373
- console.error("Webpack compilation error:", err);
1374
- process.exit(1);
1375
- }
1376
- if (stats == null ? void 0 : stats.hasErrors()) {
1377
- console.error(stats.toString({
1378
- colors: true,
1379
- errors: true
1380
- }));
1381
- process.exit(1);
1377
+ // node_modules/tsconfig-paths/lib/filesystem.js
1378
+ var require_filesystem = __commonJS({
1379
+ "node_modules/tsconfig-paths/lib/filesystem.js"(exports) {
1380
+ Object.defineProperty(exports, "__esModule", { value: true });
1381
+ exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
1382
+ var fs3 = __require("fs");
1383
+ function fileExistsSync(path7) {
1384
+ if (!fs3.existsSync(path7)) {
1385
+ return false;
1386
+ }
1387
+ try {
1388
+ var stats = fs3.statSync(path7);
1389
+ return stats.isFile();
1390
+ } catch (err) {
1391
+ return false;
1392
+ }
1382
1393
  }
1383
- console.log(stats == null ? void 0 : stats.toString({ colors: true }));
1384
- compiler.close((closeErr) => {
1385
- if (closeErr) {
1386
- console.error("Webpack close error:", closeErr);
1387
- process.exit(1);
1394
+ exports.fileExistsSync = fileExistsSync;
1395
+ function readJsonFromDiskSync(packageJsonPath) {
1396
+ if (!fs3.existsSync(packageJsonPath)) {
1397
+ return void 0;
1388
1398
  }
1389
- });
1390
- });
1391
- };
1392
- var watch = (compiler) => {
1393
- const watching = compiler.watch({
1394
- aggregateTimeout: 300,
1395
- ignored: /node_modules/
1396
- }, (err, stats) => {
1397
- if (err) {
1398
- console.error("Webpack watch error:", err);
1399
- process.exit(1);
1399
+ return __require(packageJsonPath);
1400
1400
  }
1401
- if (stats == null ? void 0 : stats.hasErrors()) {
1402
- console.error(stats.toString({
1403
- colors: true,
1404
- errors: true
1405
- }));
1406
- return;
1401
+ exports.readJsonFromDiskSync = readJsonFromDiskSync;
1402
+ function readJsonFromDiskAsync(path7, callback) {
1403
+ fs3.readFile(path7, "utf8", function(err, result) {
1404
+ if (err || !result) {
1405
+ return callback();
1406
+ }
1407
+ var json = JSON.parse(result);
1408
+ return callback(void 0, json);
1409
+ });
1407
1410
  }
1408
- console.log(stats == null ? void 0 : stats.toString({ colors: true }));
1409
- });
1410
- process.on("SIGINT", () => {
1411
- watching.close(() => {
1412
- console.log("Webpack watch mode stopped");
1413
- process.exit(0);
1414
- });
1415
- });
1416
- };
1417
-
1418
- // src/cli/resolvers/config.ts
1419
- var import_dotenv = __toESM(require_main());
1420
-
1421
- // src/core/define.ts
1422
- function definePlugin(plugin) {
1423
- return plugin;
1424
- }
1425
-
1426
- // src/cli/plugins/dotenv.ts
1427
- var dotenv_default = definePlugin((options) => {
1428
- const { vars = {} } = options || {};
1429
- return {
1430
- webpack: {
1431
- plugins: [
1432
- new webpack__default.default.DefinePlugin({
1433
- "process.env": JSON.stringify(vars)
1434
- })
1435
- ]
1411
+ exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
1412
+ function fileExistsAsync(path22, callback2) {
1413
+ fs3.stat(path22, function(err, stats) {
1414
+ if (err) {
1415
+ return callback2(void 0, false);
1416
+ }
1417
+ callback2(void 0, stats ? stats.isFile() : false);
1418
+ });
1436
1419
  }
1437
- };
1420
+ exports.fileExistsAsync = fileExistsAsync;
1421
+ function removeExtension(path7) {
1422
+ return path7.substring(0, path7.lastIndexOf(".")) || path7;
1423
+ }
1424
+ exports.removeExtension = removeExtension;
1425
+ }
1438
1426
  });
1439
1427
 
1440
- // src/cli/webpack/plugins/WatchPlugin.ts
1441
- var WatchPlugin = class {
1442
- key;
1443
- entry;
1444
- callback;
1445
- constructor({ key, entry = {}, callback }) {
1446
- this.entry = entry;
1447
- this.callback = callback;
1448
- this.key = "watch-plugin:" + (key || Object.keys(this.entry).join(","));
1449
- }
1450
- apply(compiler) {
1451
- compiler.hooks.watchRun.tapAsync("WatchPlugin", async (compiler2, callback) => {
1452
- try {
1453
- const { modifiedFiles = /* @__PURE__ */ new Set() } = compiler2;
1454
- const has = this.files.size === 0 || Array.from(modifiedFiles).some((file) => this.files.has(file));
1455
- if (has) {
1456
- const entry = await this.callback(modifiedFiles);
1457
- if (entry) {
1458
- for (const name in this.entry) {
1459
- delete compiler2.options.entry[name];
1460
- }
1461
- for (const name in entry) {
1462
- compiler2.options.entry[name] = entry[name];
1463
- }
1464
- this.entry = entry;
1465
- }
1466
- }
1467
- callback();
1468
- } catch (e) {
1469
- callback(e);
1428
+ // node_modules/tsconfig-paths/lib/mapping-entry.js
1429
+ var require_mapping_entry = __commonJS({
1430
+ "node_modules/tsconfig-paths/lib/mapping-entry.js"(exports) {
1431
+ Object.defineProperty(exports, "__esModule", { value: true });
1432
+ exports.getAbsoluteMappingEntries = void 0;
1433
+ var path7 = __require("path");
1434
+ function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
1435
+ var sortedKeys = sortByLongestPrefix(Object.keys(paths));
1436
+ var absolutePaths = [];
1437
+ for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
1438
+ var key2 = sortedKeys_1[_i];
1439
+ absolutePaths.push({
1440
+ pattern: key2,
1441
+ paths: paths[key2].map(function(pathToResolve) {
1442
+ return path7.resolve(absoluteBaseUrl, pathToResolve);
1443
+ })
1444
+ });
1470
1445
  }
1471
- });
1472
- }
1473
- get files() {
1474
- return new Set(Object.values(this.entry).flatMap((value) => Array.isArray(value) ? value : [value]));
1475
- }
1476
- };
1477
- var WatchPlugin_default = WatchPlugin;
1478
-
1479
- // src/cli/webpack/merge.ts
1480
- var import_webpack_merge = __toESM(require_dist());
1481
- var merge_default = (0, import_webpack_merge.mergeWithCustomize)({
1482
- customizeArray: (a, b, key) => {
1483
- if (key === "plugins") {
1484
- const names = /* @__PURE__ */ new Set();
1485
- return [...a, ...b].filter((plugin) => {
1486
- var _a;
1487
- let name = (_a = plugin == null ? void 0 : plugin.constructor) == null ? void 0 : _a.name;
1488
- if (plugin instanceof WatchPlugin_default) {
1489
- name = plugin.key;
1490
- }
1491
- if (names.has(name)) return false;
1492
- names.add(name);
1493
- return true;
1494
- });
1446
+ if (!paths["*"] && addMatchAll) {
1447
+ absolutePaths.push({
1448
+ pattern: "*",
1449
+ paths: ["".concat(absoluteBaseUrl.replace(/\/$/, ""), "/*")]
1450
+ });
1451
+ }
1452
+ return absolutePaths;
1495
1453
  }
1496
- if (key === "resolve.plugins") {
1497
- const names = /* @__PURE__ */ new Set();
1498
- return [...a, ...b].filter((plugin) => {
1499
- var _a;
1500
- const name = (_a = plugin == null ? void 0 : plugin.constructor) == null ? void 0 : _a.name;
1501
- if (names.has(name)) return false;
1502
- names.add(name);
1503
- return true;
1454
+ exports.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
1455
+ function sortByLongestPrefix(arr) {
1456
+ return arr.concat().sort(function(a, b) {
1457
+ return getPrefixLength(b) - getPrefixLength(a);
1504
1458
  });
1505
1459
  }
1506
- if (key === "module.rules") {
1507
- const tests = /* @__PURE__ */ new Set();
1508
- return [...a, ...b].filter((rule) => {
1509
- var _a;
1510
- const test = (_a = rule == null ? void 0 : rule.test) == null ? void 0 : _a.toString();
1511
- if (tests.has(test)) return false;
1512
- tests.add(test);
1513
- return true;
1514
- });
1460
+ function getPrefixLength(pattern) {
1461
+ var prefixLength = pattern.indexOf("*");
1462
+ return pattern.substr(0, prefixLength).length;
1515
1463
  }
1516
- return void 0;
1517
1464
  }
1518
1465
  });
1519
- var EntryFile = class _EntryFile {
1520
- constructor(file) {
1521
- this.file = file;
1522
- }
1523
- sourceFile;
1524
- variables;
1525
- imports;
1526
- enums;
1527
- resolvers;
1528
- static make(file) {
1529
- return new this(file);
1530
- }
1531
- getSourceFile() {
1532
- if (this.sourceFile) {
1533
- return this.sourceFile;
1466
+
1467
+ // node_modules/tsconfig-paths/lib/try-path.js
1468
+ var require_try_path = __commonJS({
1469
+ "node_modules/tsconfig-paths/lib/try-path.js"(exports) {
1470
+ Object.defineProperty(exports, "__esModule", { value: true });
1471
+ exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
1472
+ var path7 = __require("path");
1473
+ var path_1 = __require("path");
1474
+ var filesystem_1 = require_filesystem();
1475
+ function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
1476
+ if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") {
1477
+ return void 0;
1478
+ }
1479
+ var pathsToTry = [];
1480
+ for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
1481
+ var entry = absolutePathMappings_1[_i];
1482
+ var starMatch = entry.pattern === requestedModule ? "" : matchStar(entry.pattern, requestedModule);
1483
+ if (starMatch !== void 0) {
1484
+ var _loop_1 = function(physicalPathPattern2) {
1485
+ var physicalPath = physicalPathPattern2.replace("*", starMatch);
1486
+ pathsToTry.push({ type: "file", path: physicalPath });
1487
+ pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
1488
+ return { type: "extension", path: physicalPath + e };
1489
+ }));
1490
+ pathsToTry.push({
1491
+ type: "package",
1492
+ path: path7.join(physicalPath, "/package.json")
1493
+ });
1494
+ var indexPath = path7.join(physicalPath, "/index");
1495
+ pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
1496
+ return { type: "index", path: indexPath + e };
1497
+ }));
1498
+ };
1499
+ for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
1500
+ var physicalPathPattern = _b[_a];
1501
+ _loop_1(physicalPathPattern);
1502
+ }
1503
+ }
1504
+ }
1505
+ return pathsToTry.length === 0 ? void 0 : pathsToTry;
1534
1506
  }
1535
- const sourceCode = fs__default.default.readFileSync(this.file, "utf8");
1536
- return this.sourceFile = ts__default.default.createSourceFile(
1537
- this.file,
1538
- sourceCode,
1539
- ts__default.default.ScriptTarget.ESNext,
1540
- true
1541
- );
1542
- }
1543
- getImports() {
1544
- if (this.imports) {
1545
- return this.imports;
1507
+ exports.getPathsToTry = getPathsToTry;
1508
+ function getStrippedPath(tryPath) {
1509
+ 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);
1546
1510
  }
1547
- this.imports = /* @__PURE__ */ new Map();
1548
- const parse = (node) => {
1549
- if (ts__default.default.isImportDeclaration(node) && node.moduleSpecifier) {
1550
- const importPath = node.moduleSpecifier.text;
1551
- if (node.importClause && node.importClause.namedBindings && ts__default.default.isNamedImports(node.importClause.namedBindings)) {
1552
- node.importClause.namedBindings.elements.forEach((el) => {
1553
- var _a;
1554
- console.log(el.name.text, importPath);
1555
- (_a = this.imports) == null ? void 0 : _a.set(el.name.text, path2__default.default.resolve(path2__default.default.dirname(this.file), importPath + ".ts"));
1556
- });
1557
- }
1511
+ exports.getStrippedPath = getStrippedPath;
1512
+ function exhaustiveTypeException(check) {
1513
+ throw new Error("Unknown type ".concat(check));
1514
+ }
1515
+ exports.exhaustiveTypeException = exhaustiveTypeException;
1516
+ function matchStar(pattern, search) {
1517
+ if (search.length < pattern.length) {
1518
+ return void 0;
1558
1519
  }
1559
- ts__default.default.forEachChild(node, parse);
1560
- };
1561
- parse(this.getSourceFile());
1562
- return this.imports;
1520
+ if (pattern === "*") {
1521
+ return search;
1522
+ }
1523
+ var star = pattern.indexOf("*");
1524
+ if (star === -1) {
1525
+ return void 0;
1526
+ }
1527
+ var part1 = pattern.substring(0, star);
1528
+ var part2 = pattern.substring(star + 1);
1529
+ if (search.substr(0, star) !== part1) {
1530
+ return void 0;
1531
+ }
1532
+ if (search.substr(search.length - part2.length) !== part2) {
1533
+ return void 0;
1534
+ }
1535
+ return search.substr(star, search.length - part2.length);
1536
+ }
1563
1537
  }
1564
- getEnums() {
1565
- if (this.enums) {
1566
- return this.enums;
1538
+ });
1539
+
1540
+ // node_modules/tsconfig-paths/lib/match-path-sync.js
1541
+ var require_match_path_sync = __commonJS({
1542
+ "node_modules/tsconfig-paths/lib/match-path-sync.js"(exports) {
1543
+ Object.defineProperty(exports, "__esModule", { value: true });
1544
+ exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
1545
+ var path7 = __require("path");
1546
+ var Filesystem = require_filesystem();
1547
+ var MappingEntry = require_mapping_entry();
1548
+ var TryPath = require_try_path();
1549
+ function createMatchPath2(absoluteBaseUrl, paths, mainFields, addMatchAll) {
1550
+ if (mainFields === void 0) {
1551
+ mainFields = ["main"];
1552
+ }
1553
+ if (addMatchAll === void 0) {
1554
+ addMatchAll = true;
1555
+ }
1556
+ var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
1557
+ return function(requestedModule, readJson, fileExists, extensions) {
1558
+ return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields);
1559
+ };
1567
1560
  }
1568
- this.enums = /* @__PURE__ */ new Map();
1569
- const parse = (node) => {
1570
- var _a;
1571
- if (ts__default.default.isEnumDeclaration(node)) {
1572
- const enumName = node.name.text;
1573
- const enumProperties = /* @__PURE__ */ new Map();
1574
- node.members.forEach((member) => {
1575
- const key = member.name.getText();
1576
- const value = member.initializer ? member.initializer.getText().replace(/['"]/g, "") : key;
1577
- enumProperties.set(key, value);
1578
- });
1579
- (_a = this.enums) == null ? void 0 : _a.set(enumName, enumProperties);
1561
+ exports.createMatchPath = createMatchPath2;
1562
+ function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) {
1563
+ if (readJson === void 0) {
1564
+ readJson = Filesystem.readJsonFromDiskSync;
1580
1565
  }
1581
- ts__default.default.forEachChild(node, parse);
1582
- };
1583
- parse(this.getSourceFile());
1584
- return this.enums;
1585
- }
1586
- getVariables() {
1587
- if (this.variables) {
1588
- return this.variables;
1566
+ if (fileExists === void 0) {
1567
+ fileExists = Filesystem.fileExistsSync;
1568
+ }
1569
+ if (extensions === void 0) {
1570
+ extensions = Object.keys(__require.extensions);
1571
+ }
1572
+ if (mainFields === void 0) {
1573
+ mainFields = ["main"];
1574
+ }
1575
+ var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
1576
+ if (!tryPaths) {
1577
+ return void 0;
1578
+ }
1579
+ return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
1589
1580
  }
1590
- this.variables = /* @__PURE__ */ new Map();
1591
- const parse = (node) => {
1592
- var _a, _b, _c, _d;
1593
- if (ts__default.default.isVariableStatement(node)) {
1594
- const isExported = (_a = node.modifiers) == null ? void 0 : _a.some((modifier) => modifier.kind === ts__default.default.SyntaxKind.ExportKeyword);
1595
- node.declarationList.declarations.forEach((declaration) => {
1596
- var _a2;
1597
- if (ts__default.default.isIdentifier(declaration.name) && declaration.initializer) {
1598
- const name = declaration.name.text;
1599
- const value = this.parseNode(declaration.initializer);
1600
- (_a2 = this.variables) == null ? void 0 : _a2.set(name, {
1601
- name,
1602
- value,
1603
- exported: isExported || false
1604
- });
1581
+ exports.matchFromAbsolutePaths = matchFromAbsolutePaths;
1582
+ function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) {
1583
+ for (var index = 0; index < mainFields.length; index++) {
1584
+ var mainFieldSelector = mainFields[index];
1585
+ var candidateMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key2) {
1586
+ return obj[key2];
1587
+ }, packageJson);
1588
+ if (candidateMapping && typeof candidateMapping === "string") {
1589
+ var candidateFilePath = path7.join(path7.dirname(packageJsonPath), candidateMapping);
1590
+ if (fileExists(candidateFilePath)) {
1591
+ return candidateFilePath;
1605
1592
  }
1606
- });
1593
+ }
1607
1594
  }
1608
- if (ts__default.default.isExportDeclaration(node) && node.exportClause && ts__default.default.isNamedExports(node.exportClause)) {
1609
- node.exportClause.elements.forEach((el) => {
1610
- var _a2, _b2, _c2;
1611
- const name = el.name.text;
1612
- if ((_a2 = this.variables) == null ? void 0 : _a2.has(name)) {
1613
- const variable = (_b2 = this.variables) == null ? void 0 : _b2.get(name);
1614
- (_c2 = this.variables) == null ? void 0 : _c2.set(name, {
1615
- name,
1616
- value: variable.value,
1617
- exported: true
1618
- });
1619
- }
1620
- });
1595
+ return void 0;
1596
+ }
1597
+ function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) {
1598
+ if (readJson === void 0) {
1599
+ readJson = Filesystem.readJsonFromDiskSync;
1621
1600
  }
1622
- if (ts__default.default.isExportAssignment(node)) {
1623
- const expr = node.expression;
1624
- if (ts__default.default.isIdentifier(expr) && ((_b = this.variables) == null ? void 0 : _b.has(expr.text))) {
1625
- const variable = (_c = this.variables) == null ? void 0 : _c.get(expr.text);
1626
- const name = "default";
1627
- (_d = this.variables) == null ? void 0 : _d.set(name, {
1628
- name,
1629
- value: variable.value,
1630
- exported: true
1631
- });
1601
+ if (mainFields === void 0) {
1602
+ mainFields = ["main"];
1603
+ }
1604
+ for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) {
1605
+ var tryPath = tryPaths_1[_i];
1606
+ if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
1607
+ if (fileExists(tryPath.path)) {
1608
+ return TryPath.getStrippedPath(tryPath);
1609
+ }
1610
+ } else if (tryPath.type === "package") {
1611
+ var packageJson = readJson(tryPath.path);
1612
+ if (packageJson) {
1613
+ var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists);
1614
+ if (mainFieldMappedFile) {
1615
+ return mainFieldMappedFile;
1616
+ }
1617
+ }
1618
+ } else {
1619
+ TryPath.exhaustiveTypeException(tryPath.type);
1632
1620
  }
1633
1621
  }
1634
- ts__default.default.forEachChild(node, parse);
1635
- };
1636
- parse(this.getSourceFile());
1637
- return this.variables;
1622
+ return void 0;
1623
+ }
1638
1624
  }
1639
- findPropertyAccessValue(property) {
1640
- if (ts__default.default.isPropertyAccessExpression(property)) {
1641
- const objectName = property.expression.getText();
1642
- const propertyName = property.name.getText();
1625
+ });
1626
+
1627
+ // node_modules/tsconfig-paths/lib/match-path-async.js
1628
+ var require_match_path_async = __commonJS({
1629
+ "node_modules/tsconfig-paths/lib/match-path-async.js"(exports) {
1630
+ Object.defineProperty(exports, "__esModule", { value: true });
1631
+ exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
1632
+ var path7 = __require("path");
1633
+ var TryPath = require_try_path();
1634
+ var MappingEntry = require_mapping_entry();
1635
+ var Filesystem = require_filesystem();
1636
+ function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
1637
+ if (mainFields === void 0) {
1638
+ mainFields = ["main"];
1639
+ }
1640
+ if (addMatchAll === void 0) {
1641
+ addMatchAll = true;
1642
+ }
1643
+ var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
1644
+ return function(requestedModule, readJson, fileExists, extensions, callback) {
1645
+ return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields);
1646
+ };
1647
+ }
1648
+ exports.createMatchPathAsync = createMatchPathAsync;
1649
+ function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) {
1650
+ if (readJson === void 0) {
1651
+ readJson = Filesystem.readJsonFromDiskAsync;
1652
+ }
1653
+ if (fileExists === void 0) {
1654
+ fileExists = Filesystem.fileExistsAsync;
1655
+ }
1656
+ if (extensions === void 0) {
1657
+ extensions = Object.keys(__require.extensions);
1658
+ }
1659
+ if (mainFields === void 0) {
1660
+ mainFields = ["main"];
1661
+ }
1662
+ var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
1663
+ if (!tryPaths) {
1664
+ return callback();
1665
+ }
1666
+ findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields);
1667
+ }
1668
+ exports.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync;
1669
+ function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index) {
1670
+ if (index === void 0) {
1671
+ index = 0;
1672
+ }
1673
+ if (index >= mainFields.length) {
1674
+ return doneCallback(void 0, void 0);
1675
+ }
1676
+ var tryNext = function() {
1677
+ return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index + 1);
1678
+ };
1679
+ var mainFieldSelector = mainFields[index];
1680
+ var mainFieldMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key2) {
1681
+ return obj[key2];
1682
+ }, packageJson);
1683
+ if (typeof mainFieldMapping !== "string") {
1684
+ return tryNext();
1685
+ }
1686
+ var mappedFilePath = path7.join(path7.dirname(packageJsonPath), mainFieldMapping);
1687
+ fileExistsAsync(mappedFilePath, function(err, exists) {
1688
+ if (err) {
1689
+ return doneCallback(err);
1690
+ }
1691
+ if (exists) {
1692
+ return doneCallback(void 0, mappedFilePath);
1693
+ }
1694
+ return tryNext();
1695
+ });
1696
+ }
1697
+ function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index, mainFields) {
1698
+ if (index === void 0) {
1699
+ index = 0;
1700
+ }
1701
+ if (mainFields === void 0) {
1702
+ mainFields = ["main"];
1703
+ }
1704
+ var tryPath = tryPaths[index];
1705
+ if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
1706
+ fileExists(tryPath.path, function(err, exists) {
1707
+ if (err) {
1708
+ return doneCallback(err);
1709
+ }
1710
+ if (exists) {
1711
+ return doneCallback(void 0, TryPath.getStrippedPath(tryPath));
1712
+ }
1713
+ if (index === tryPaths.length - 1) {
1714
+ return doneCallback();
1715
+ }
1716
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
1717
+ });
1718
+ } else if (tryPath.type === "package") {
1719
+ readJson(tryPath.path, function(err, packageJson) {
1720
+ if (err) {
1721
+ return doneCallback(err);
1722
+ }
1723
+ if (packageJson) {
1724
+ return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function(mainFieldErr, mainFieldMappedFile) {
1725
+ if (mainFieldErr) {
1726
+ return doneCallback(mainFieldErr);
1727
+ }
1728
+ if (mainFieldMappedFile) {
1729
+ return doneCallback(void 0, mainFieldMappedFile);
1730
+ }
1731
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
1732
+ });
1733
+ }
1734
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
1735
+ });
1736
+ } else {
1737
+ TryPath.exhaustiveTypeException(tryPath.type);
1738
+ }
1739
+ }
1740
+ }
1741
+ });
1742
+
1743
+ // node_modules/json5/dist/index.mjs
1744
+ var dist_exports = {};
1745
+ __export(dist_exports, {
1746
+ default: () => dist_default
1747
+ });
1748
+ function internalize(holder, name2, reviver) {
1749
+ const value = holder[name2];
1750
+ if (value != null && typeof value === "object") {
1751
+ if (Array.isArray(value)) {
1752
+ for (let i = 0; i < value.length; i++) {
1753
+ const key2 = String(i);
1754
+ const replacement = internalize(value, key2, reviver);
1755
+ if (replacement === void 0) {
1756
+ delete value[key2];
1757
+ } else {
1758
+ Object.defineProperty(value, key2, {
1759
+ value: replacement,
1760
+ writable: true,
1761
+ enumerable: true,
1762
+ configurable: true
1763
+ });
1764
+ }
1765
+ }
1766
+ } else {
1767
+ for (const key2 in value) {
1768
+ const replacement = internalize(value, key2, reviver);
1769
+ if (replacement === void 0) {
1770
+ delete value[key2];
1771
+ } else {
1772
+ Object.defineProperty(value, key2, {
1773
+ value: replacement,
1774
+ writable: true,
1775
+ enumerable: true,
1776
+ configurable: true
1777
+ });
1778
+ }
1779
+ }
1780
+ }
1781
+ }
1782
+ return reviver.call(holder, name2, value);
1783
+ }
1784
+ function lex() {
1785
+ lexState = "default";
1786
+ buffer = "";
1787
+ doubleQuote = false;
1788
+ sign = 1;
1789
+ for (; ; ) {
1790
+ c = peek();
1791
+ const token2 = lexStates[lexState]();
1792
+ if (token2) {
1793
+ return token2;
1794
+ }
1795
+ }
1796
+ }
1797
+ function peek() {
1798
+ if (source[pos]) {
1799
+ return String.fromCodePoint(source.codePointAt(pos));
1800
+ }
1801
+ }
1802
+ function read() {
1803
+ const c2 = peek();
1804
+ if (c2 === "\n") {
1805
+ line++;
1806
+ column = 0;
1807
+ } else if (c2) {
1808
+ column += c2.length;
1809
+ } else {
1810
+ column++;
1811
+ }
1812
+ if (c2) {
1813
+ pos += c2.length;
1814
+ }
1815
+ return c2;
1816
+ }
1817
+ function newToken(type, value) {
1818
+ return {
1819
+ type,
1820
+ value,
1821
+ line,
1822
+ column
1823
+ };
1824
+ }
1825
+ function literal(s) {
1826
+ for (const c2 of s) {
1827
+ const p = peek();
1828
+ if (p !== c2) {
1829
+ throw invalidChar(read());
1830
+ }
1831
+ read();
1832
+ }
1833
+ }
1834
+ function escape() {
1835
+ const c2 = peek();
1836
+ switch (c2) {
1837
+ case "b":
1838
+ read();
1839
+ return "\b";
1840
+ case "f":
1841
+ read();
1842
+ return "\f";
1843
+ case "n":
1844
+ read();
1845
+ return "\n";
1846
+ case "r":
1847
+ read();
1848
+ return "\r";
1849
+ case "t":
1850
+ read();
1851
+ return " ";
1852
+ case "v":
1853
+ read();
1854
+ return "\v";
1855
+ case "0":
1856
+ read();
1857
+ if (util.isDigit(peek())) {
1858
+ throw invalidChar(read());
1859
+ }
1860
+ return "\0";
1861
+ case "x":
1862
+ read();
1863
+ return hexEscape();
1864
+ case "u":
1865
+ read();
1866
+ return unicodeEscape();
1867
+ case "\n":
1868
+ case "\u2028":
1869
+ case "\u2029":
1870
+ read();
1871
+ return "";
1872
+ case "\r":
1873
+ read();
1874
+ if (peek() === "\n") {
1875
+ read();
1876
+ }
1877
+ return "";
1878
+ case "1":
1879
+ case "2":
1880
+ case "3":
1881
+ case "4":
1882
+ case "5":
1883
+ case "6":
1884
+ case "7":
1885
+ case "8":
1886
+ case "9":
1887
+ throw invalidChar(read());
1888
+ case void 0:
1889
+ throw invalidChar(read());
1890
+ }
1891
+ return read();
1892
+ }
1893
+ function hexEscape() {
1894
+ let buffer2 = "";
1895
+ let c2 = peek();
1896
+ if (!util.isHexDigit(c2)) {
1897
+ throw invalidChar(read());
1898
+ }
1899
+ buffer2 += read();
1900
+ c2 = peek();
1901
+ if (!util.isHexDigit(c2)) {
1902
+ throw invalidChar(read());
1903
+ }
1904
+ buffer2 += read();
1905
+ return String.fromCodePoint(parseInt(buffer2, 16));
1906
+ }
1907
+ function unicodeEscape() {
1908
+ let buffer2 = "";
1909
+ let count = 4;
1910
+ while (count-- > 0) {
1911
+ const c2 = peek();
1912
+ if (!util.isHexDigit(c2)) {
1913
+ throw invalidChar(read());
1914
+ }
1915
+ buffer2 += read();
1916
+ }
1917
+ return String.fromCodePoint(parseInt(buffer2, 16));
1918
+ }
1919
+ function push() {
1920
+ let value;
1921
+ switch (token.type) {
1922
+ case "punctuator":
1923
+ switch (token.value) {
1924
+ case "{":
1925
+ value = {};
1926
+ break;
1927
+ case "[":
1928
+ value = [];
1929
+ break;
1930
+ }
1931
+ break;
1932
+ case "null":
1933
+ case "boolean":
1934
+ case "numeric":
1935
+ case "string":
1936
+ value = token.value;
1937
+ break;
1938
+ }
1939
+ if (root === void 0) {
1940
+ root = value;
1941
+ } else {
1942
+ const parent = stack[stack.length - 1];
1943
+ if (Array.isArray(parent)) {
1944
+ parent.push(value);
1945
+ } else {
1946
+ Object.defineProperty(parent, key, {
1947
+ value,
1948
+ writable: true,
1949
+ enumerable: true,
1950
+ configurable: true
1951
+ });
1952
+ }
1953
+ }
1954
+ if (value !== null && typeof value === "object") {
1955
+ stack.push(value);
1956
+ if (Array.isArray(value)) {
1957
+ parseState = "beforeArrayValue";
1958
+ } else {
1959
+ parseState = "beforePropertyName";
1960
+ }
1961
+ } else {
1962
+ const current = stack[stack.length - 1];
1963
+ if (current == null) {
1964
+ parseState = "end";
1965
+ } else if (Array.isArray(current)) {
1966
+ parseState = "afterArrayValue";
1967
+ } else {
1968
+ parseState = "afterPropertyValue";
1969
+ }
1970
+ }
1971
+ }
1972
+ function pop() {
1973
+ stack.pop();
1974
+ const current = stack[stack.length - 1];
1975
+ if (current == null) {
1976
+ parseState = "end";
1977
+ } else if (Array.isArray(current)) {
1978
+ parseState = "afterArrayValue";
1979
+ } else {
1980
+ parseState = "afterPropertyValue";
1981
+ }
1982
+ }
1983
+ function invalidChar(c2) {
1984
+ if (c2 === void 0) {
1985
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
1986
+ }
1987
+ return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
1988
+ }
1989
+ function invalidEOF() {
1990
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
1991
+ }
1992
+ function invalidIdentifier() {
1993
+ column -= 5;
1994
+ return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
1995
+ }
1996
+ function separatorChar(c2) {
1997
+ console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
1998
+ }
1999
+ function formatChar(c2) {
2000
+ const replacements = {
2001
+ "'": "\\'",
2002
+ '"': '\\"',
2003
+ "\\": "\\\\",
2004
+ "\b": "\\b",
2005
+ "\f": "\\f",
2006
+ "\n": "\\n",
2007
+ "\r": "\\r",
2008
+ " ": "\\t",
2009
+ "\v": "\\v",
2010
+ "\0": "\\0",
2011
+ "\u2028": "\\u2028",
2012
+ "\u2029": "\\u2029"
2013
+ };
2014
+ if (replacements[c2]) {
2015
+ return replacements[c2];
2016
+ }
2017
+ if (c2 < " ") {
2018
+ const hexString = c2.charCodeAt(0).toString(16);
2019
+ return "\\x" + ("00" + hexString).substring(hexString.length);
2020
+ }
2021
+ return c2;
2022
+ }
2023
+ function syntaxError(message) {
2024
+ const err = new SyntaxError(message);
2025
+ err.lineNumber = line;
2026
+ err.columnNumber = column;
2027
+ return err;
2028
+ }
2029
+ var Space_Separator, ID_Start, ID_Continue, unicode, util, source, parseState, stack, pos, line, column, token, key, root, parse, lexState, buffer, doubleQuote, sign, c, lexStates, parseStates, stringify, JSON5, lib, dist_default;
2030
+ var init_dist = __esm({
2031
+ "node_modules/json5/dist/index.mjs"() {
2032
+ Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
2033
+ 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]/;
2034
+ 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]/;
2035
+ unicode = {
2036
+ Space_Separator,
2037
+ ID_Start,
2038
+ ID_Continue
2039
+ };
2040
+ util = {
2041
+ isSpaceSeparator(c2) {
2042
+ return typeof c2 === "string" && unicode.Space_Separator.test(c2);
2043
+ },
2044
+ isIdStartChar(c2) {
2045
+ return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 === "$" || c2 === "_" || unicode.ID_Start.test(c2));
2046
+ },
2047
+ isIdContinueChar(c2) {
2048
+ return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 >= "0" && c2 <= "9" || c2 === "$" || c2 === "_" || c2 === "\u200C" || c2 === "\u200D" || unicode.ID_Continue.test(c2));
2049
+ },
2050
+ isDigit(c2) {
2051
+ return typeof c2 === "string" && /[0-9]/.test(c2);
2052
+ },
2053
+ isHexDigit(c2) {
2054
+ return typeof c2 === "string" && /[0-9A-Fa-f]/.test(c2);
2055
+ }
2056
+ };
2057
+ parse = function parse2(text, reviver) {
2058
+ source = String(text);
2059
+ parseState = "start";
2060
+ stack = [];
2061
+ pos = 0;
2062
+ line = 1;
2063
+ column = 0;
2064
+ token = void 0;
2065
+ key = void 0;
2066
+ root = void 0;
2067
+ do {
2068
+ token = lex();
2069
+ parseStates[parseState]();
2070
+ } while (token.type !== "eof");
2071
+ if (typeof reviver === "function") {
2072
+ return internalize({ "": root }, "", reviver);
2073
+ }
2074
+ return root;
2075
+ };
2076
+ lexStates = {
2077
+ default() {
2078
+ switch (c) {
2079
+ case " ":
2080
+ case "\v":
2081
+ case "\f":
2082
+ case " ":
2083
+ case "\xA0":
2084
+ case "\uFEFF":
2085
+ case "\n":
2086
+ case "\r":
2087
+ case "\u2028":
2088
+ case "\u2029":
2089
+ read();
2090
+ return;
2091
+ case "/":
2092
+ read();
2093
+ lexState = "comment";
2094
+ return;
2095
+ case void 0:
2096
+ read();
2097
+ return newToken("eof");
2098
+ }
2099
+ if (util.isSpaceSeparator(c)) {
2100
+ read();
2101
+ return;
2102
+ }
2103
+ return lexStates[parseState]();
2104
+ },
2105
+ comment() {
2106
+ switch (c) {
2107
+ case "*":
2108
+ read();
2109
+ lexState = "multiLineComment";
2110
+ return;
2111
+ case "/":
2112
+ read();
2113
+ lexState = "singleLineComment";
2114
+ return;
2115
+ }
2116
+ throw invalidChar(read());
2117
+ },
2118
+ multiLineComment() {
2119
+ switch (c) {
2120
+ case "*":
2121
+ read();
2122
+ lexState = "multiLineCommentAsterisk";
2123
+ return;
2124
+ case void 0:
2125
+ throw invalidChar(read());
2126
+ }
2127
+ read();
2128
+ },
2129
+ multiLineCommentAsterisk() {
2130
+ switch (c) {
2131
+ case "*":
2132
+ read();
2133
+ return;
2134
+ case "/":
2135
+ read();
2136
+ lexState = "default";
2137
+ return;
2138
+ case void 0:
2139
+ throw invalidChar(read());
2140
+ }
2141
+ read();
2142
+ lexState = "multiLineComment";
2143
+ },
2144
+ singleLineComment() {
2145
+ switch (c) {
2146
+ case "\n":
2147
+ case "\r":
2148
+ case "\u2028":
2149
+ case "\u2029":
2150
+ read();
2151
+ lexState = "default";
2152
+ return;
2153
+ case void 0:
2154
+ read();
2155
+ return newToken("eof");
2156
+ }
2157
+ read();
2158
+ },
2159
+ value() {
2160
+ switch (c) {
2161
+ case "{":
2162
+ case "[":
2163
+ return newToken("punctuator", read());
2164
+ case "n":
2165
+ read();
2166
+ literal("ull");
2167
+ return newToken("null", null);
2168
+ case "t":
2169
+ read();
2170
+ literal("rue");
2171
+ return newToken("boolean", true);
2172
+ case "f":
2173
+ read();
2174
+ literal("alse");
2175
+ return newToken("boolean", false);
2176
+ case "-":
2177
+ case "+":
2178
+ if (read() === "-") {
2179
+ sign = -1;
2180
+ }
2181
+ lexState = "sign";
2182
+ return;
2183
+ case ".":
2184
+ buffer = read();
2185
+ lexState = "decimalPointLeading";
2186
+ return;
2187
+ case "0":
2188
+ buffer = read();
2189
+ lexState = "zero";
2190
+ return;
2191
+ case "1":
2192
+ case "2":
2193
+ case "3":
2194
+ case "4":
2195
+ case "5":
2196
+ case "6":
2197
+ case "7":
2198
+ case "8":
2199
+ case "9":
2200
+ buffer = read();
2201
+ lexState = "decimalInteger";
2202
+ return;
2203
+ case "I":
2204
+ read();
2205
+ literal("nfinity");
2206
+ return newToken("numeric", Infinity);
2207
+ case "N":
2208
+ read();
2209
+ literal("aN");
2210
+ return newToken("numeric", NaN);
2211
+ case '"':
2212
+ case "'":
2213
+ doubleQuote = read() === '"';
2214
+ buffer = "";
2215
+ lexState = "string";
2216
+ return;
2217
+ }
2218
+ throw invalidChar(read());
2219
+ },
2220
+ identifierNameStartEscape() {
2221
+ if (c !== "u") {
2222
+ throw invalidChar(read());
2223
+ }
2224
+ read();
2225
+ const u = unicodeEscape();
2226
+ switch (u) {
2227
+ case "$":
2228
+ case "_":
2229
+ break;
2230
+ default:
2231
+ if (!util.isIdStartChar(u)) {
2232
+ throw invalidIdentifier();
2233
+ }
2234
+ break;
2235
+ }
2236
+ buffer += u;
2237
+ lexState = "identifierName";
2238
+ },
2239
+ identifierName() {
2240
+ switch (c) {
2241
+ case "$":
2242
+ case "_":
2243
+ case "\u200C":
2244
+ case "\u200D":
2245
+ buffer += read();
2246
+ return;
2247
+ case "\\":
2248
+ read();
2249
+ lexState = "identifierNameEscape";
2250
+ return;
2251
+ }
2252
+ if (util.isIdContinueChar(c)) {
2253
+ buffer += read();
2254
+ return;
2255
+ }
2256
+ return newToken("identifier", buffer);
2257
+ },
2258
+ identifierNameEscape() {
2259
+ if (c !== "u") {
2260
+ throw invalidChar(read());
2261
+ }
2262
+ read();
2263
+ const u = unicodeEscape();
2264
+ switch (u) {
2265
+ case "$":
2266
+ case "_":
2267
+ case "\u200C":
2268
+ case "\u200D":
2269
+ break;
2270
+ default:
2271
+ if (!util.isIdContinueChar(u)) {
2272
+ throw invalidIdentifier();
2273
+ }
2274
+ break;
2275
+ }
2276
+ buffer += u;
2277
+ lexState = "identifierName";
2278
+ },
2279
+ sign() {
2280
+ switch (c) {
2281
+ case ".":
2282
+ buffer = read();
2283
+ lexState = "decimalPointLeading";
2284
+ return;
2285
+ case "0":
2286
+ buffer = read();
2287
+ lexState = "zero";
2288
+ return;
2289
+ case "1":
2290
+ case "2":
2291
+ case "3":
2292
+ case "4":
2293
+ case "5":
2294
+ case "6":
2295
+ case "7":
2296
+ case "8":
2297
+ case "9":
2298
+ buffer = read();
2299
+ lexState = "decimalInteger";
2300
+ return;
2301
+ case "I":
2302
+ read();
2303
+ literal("nfinity");
2304
+ return newToken("numeric", sign * Infinity);
2305
+ case "N":
2306
+ read();
2307
+ literal("aN");
2308
+ return newToken("numeric", NaN);
2309
+ }
2310
+ throw invalidChar(read());
2311
+ },
2312
+ zero() {
2313
+ switch (c) {
2314
+ case ".":
2315
+ buffer += read();
2316
+ lexState = "decimalPoint";
2317
+ return;
2318
+ case "e":
2319
+ case "E":
2320
+ buffer += read();
2321
+ lexState = "decimalExponent";
2322
+ return;
2323
+ case "x":
2324
+ case "X":
2325
+ buffer += read();
2326
+ lexState = "hexadecimal";
2327
+ return;
2328
+ }
2329
+ return newToken("numeric", sign * 0);
2330
+ },
2331
+ decimalInteger() {
2332
+ switch (c) {
2333
+ case ".":
2334
+ buffer += read();
2335
+ lexState = "decimalPoint";
2336
+ return;
2337
+ case "e":
2338
+ case "E":
2339
+ buffer += read();
2340
+ lexState = "decimalExponent";
2341
+ return;
2342
+ }
2343
+ if (util.isDigit(c)) {
2344
+ buffer += read();
2345
+ return;
2346
+ }
2347
+ return newToken("numeric", sign * Number(buffer));
2348
+ },
2349
+ decimalPointLeading() {
2350
+ if (util.isDigit(c)) {
2351
+ buffer += read();
2352
+ lexState = "decimalFraction";
2353
+ return;
2354
+ }
2355
+ throw invalidChar(read());
2356
+ },
2357
+ decimalPoint() {
2358
+ switch (c) {
2359
+ case "e":
2360
+ case "E":
2361
+ buffer += read();
2362
+ lexState = "decimalExponent";
2363
+ return;
2364
+ }
2365
+ if (util.isDigit(c)) {
2366
+ buffer += read();
2367
+ lexState = "decimalFraction";
2368
+ return;
2369
+ }
2370
+ return newToken("numeric", sign * Number(buffer));
2371
+ },
2372
+ decimalFraction() {
2373
+ switch (c) {
2374
+ case "e":
2375
+ case "E":
2376
+ buffer += read();
2377
+ lexState = "decimalExponent";
2378
+ return;
2379
+ }
2380
+ if (util.isDigit(c)) {
2381
+ buffer += read();
2382
+ return;
2383
+ }
2384
+ return newToken("numeric", sign * Number(buffer));
2385
+ },
2386
+ decimalExponent() {
2387
+ switch (c) {
2388
+ case "+":
2389
+ case "-":
2390
+ buffer += read();
2391
+ lexState = "decimalExponentSign";
2392
+ return;
2393
+ }
2394
+ if (util.isDigit(c)) {
2395
+ buffer += read();
2396
+ lexState = "decimalExponentInteger";
2397
+ return;
2398
+ }
2399
+ throw invalidChar(read());
2400
+ },
2401
+ decimalExponentSign() {
2402
+ if (util.isDigit(c)) {
2403
+ buffer += read();
2404
+ lexState = "decimalExponentInteger";
2405
+ return;
2406
+ }
2407
+ throw invalidChar(read());
2408
+ },
2409
+ decimalExponentInteger() {
2410
+ if (util.isDigit(c)) {
2411
+ buffer += read();
2412
+ return;
2413
+ }
2414
+ return newToken("numeric", sign * Number(buffer));
2415
+ },
2416
+ hexadecimal() {
2417
+ if (util.isHexDigit(c)) {
2418
+ buffer += read();
2419
+ lexState = "hexadecimalInteger";
2420
+ return;
2421
+ }
2422
+ throw invalidChar(read());
2423
+ },
2424
+ hexadecimalInteger() {
2425
+ if (util.isHexDigit(c)) {
2426
+ buffer += read();
2427
+ return;
2428
+ }
2429
+ return newToken("numeric", sign * Number(buffer));
2430
+ },
2431
+ string() {
2432
+ switch (c) {
2433
+ case "\\":
2434
+ read();
2435
+ buffer += escape();
2436
+ return;
2437
+ case '"':
2438
+ if (doubleQuote) {
2439
+ read();
2440
+ return newToken("string", buffer);
2441
+ }
2442
+ buffer += read();
2443
+ return;
2444
+ case "'":
2445
+ if (!doubleQuote) {
2446
+ read();
2447
+ return newToken("string", buffer);
2448
+ }
2449
+ buffer += read();
2450
+ return;
2451
+ case "\n":
2452
+ case "\r":
2453
+ throw invalidChar(read());
2454
+ case "\u2028":
2455
+ case "\u2029":
2456
+ separatorChar(c);
2457
+ break;
2458
+ case void 0:
2459
+ throw invalidChar(read());
2460
+ }
2461
+ buffer += read();
2462
+ },
2463
+ start() {
2464
+ switch (c) {
2465
+ case "{":
2466
+ case "[":
2467
+ return newToken("punctuator", read());
2468
+ }
2469
+ lexState = "value";
2470
+ },
2471
+ beforePropertyName() {
2472
+ switch (c) {
2473
+ case "$":
2474
+ case "_":
2475
+ buffer = read();
2476
+ lexState = "identifierName";
2477
+ return;
2478
+ case "\\":
2479
+ read();
2480
+ lexState = "identifierNameStartEscape";
2481
+ return;
2482
+ case "}":
2483
+ return newToken("punctuator", read());
2484
+ case '"':
2485
+ case "'":
2486
+ doubleQuote = read() === '"';
2487
+ lexState = "string";
2488
+ return;
2489
+ }
2490
+ if (util.isIdStartChar(c)) {
2491
+ buffer += read();
2492
+ lexState = "identifierName";
2493
+ return;
2494
+ }
2495
+ throw invalidChar(read());
2496
+ },
2497
+ afterPropertyName() {
2498
+ if (c === ":") {
2499
+ return newToken("punctuator", read());
2500
+ }
2501
+ throw invalidChar(read());
2502
+ },
2503
+ beforePropertyValue() {
2504
+ lexState = "value";
2505
+ },
2506
+ afterPropertyValue() {
2507
+ switch (c) {
2508
+ case ",":
2509
+ case "}":
2510
+ return newToken("punctuator", read());
2511
+ }
2512
+ throw invalidChar(read());
2513
+ },
2514
+ beforeArrayValue() {
2515
+ if (c === "]") {
2516
+ return newToken("punctuator", read());
2517
+ }
2518
+ lexState = "value";
2519
+ },
2520
+ afterArrayValue() {
2521
+ switch (c) {
2522
+ case ",":
2523
+ case "]":
2524
+ return newToken("punctuator", read());
2525
+ }
2526
+ throw invalidChar(read());
2527
+ },
2528
+ end() {
2529
+ throw invalidChar(read());
2530
+ }
2531
+ };
2532
+ parseStates = {
2533
+ start() {
2534
+ if (token.type === "eof") {
2535
+ throw invalidEOF();
2536
+ }
2537
+ push();
2538
+ },
2539
+ beforePropertyName() {
2540
+ switch (token.type) {
2541
+ case "identifier":
2542
+ case "string":
2543
+ key = token.value;
2544
+ parseState = "afterPropertyName";
2545
+ return;
2546
+ case "punctuator":
2547
+ pop();
2548
+ return;
2549
+ case "eof":
2550
+ throw invalidEOF();
2551
+ }
2552
+ },
2553
+ afterPropertyName() {
2554
+ if (token.type === "eof") {
2555
+ throw invalidEOF();
2556
+ }
2557
+ parseState = "beforePropertyValue";
2558
+ },
2559
+ beforePropertyValue() {
2560
+ if (token.type === "eof") {
2561
+ throw invalidEOF();
2562
+ }
2563
+ push();
2564
+ },
2565
+ beforeArrayValue() {
2566
+ if (token.type === "eof") {
2567
+ throw invalidEOF();
2568
+ }
2569
+ if (token.type === "punctuator" && token.value === "]") {
2570
+ pop();
2571
+ return;
2572
+ }
2573
+ push();
2574
+ },
2575
+ afterPropertyValue() {
2576
+ if (token.type === "eof") {
2577
+ throw invalidEOF();
2578
+ }
2579
+ switch (token.value) {
2580
+ case ",":
2581
+ parseState = "beforePropertyName";
2582
+ return;
2583
+ case "}":
2584
+ pop();
2585
+ }
2586
+ },
2587
+ afterArrayValue() {
2588
+ if (token.type === "eof") {
2589
+ throw invalidEOF();
2590
+ }
2591
+ switch (token.value) {
2592
+ case ",":
2593
+ parseState = "beforeArrayValue";
2594
+ return;
2595
+ case "]":
2596
+ pop();
2597
+ }
2598
+ },
2599
+ end() {
2600
+ }
2601
+ };
2602
+ stringify = function stringify2(value, replacer, space) {
2603
+ const stack2 = [];
2604
+ let indent = "";
2605
+ let propertyList;
2606
+ let replacerFunc;
2607
+ let gap = "";
2608
+ let quote;
2609
+ if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
2610
+ space = replacer.space;
2611
+ quote = replacer.quote;
2612
+ replacer = replacer.replacer;
2613
+ }
2614
+ if (typeof replacer === "function") {
2615
+ replacerFunc = replacer;
2616
+ } else if (Array.isArray(replacer)) {
2617
+ propertyList = [];
2618
+ for (const v of replacer) {
2619
+ let item;
2620
+ if (typeof v === "string") {
2621
+ item = v;
2622
+ } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
2623
+ item = String(v);
2624
+ }
2625
+ if (item !== void 0 && propertyList.indexOf(item) < 0) {
2626
+ propertyList.push(item);
2627
+ }
2628
+ }
2629
+ }
2630
+ if (space instanceof Number) {
2631
+ space = Number(space);
2632
+ } else if (space instanceof String) {
2633
+ space = String(space);
2634
+ }
2635
+ if (typeof space === "number") {
2636
+ if (space > 0) {
2637
+ space = Math.min(10, Math.floor(space));
2638
+ gap = " ".substr(0, space);
2639
+ }
2640
+ } else if (typeof space === "string") {
2641
+ gap = space.substr(0, 10);
2642
+ }
2643
+ return serializeProperty("", { "": value });
2644
+ function serializeProperty(key2, holder) {
2645
+ let value2 = holder[key2];
2646
+ if (value2 != null) {
2647
+ if (typeof value2.toJSON5 === "function") {
2648
+ value2 = value2.toJSON5(key2);
2649
+ } else if (typeof value2.toJSON === "function") {
2650
+ value2 = value2.toJSON(key2);
2651
+ }
2652
+ }
2653
+ if (replacerFunc) {
2654
+ value2 = replacerFunc.call(holder, key2, value2);
2655
+ }
2656
+ if (value2 instanceof Number) {
2657
+ value2 = Number(value2);
2658
+ } else if (value2 instanceof String) {
2659
+ value2 = String(value2);
2660
+ } else if (value2 instanceof Boolean) {
2661
+ value2 = value2.valueOf();
2662
+ }
2663
+ switch (value2) {
2664
+ case null:
2665
+ return "null";
2666
+ case true:
2667
+ return "true";
2668
+ case false:
2669
+ return "false";
2670
+ }
2671
+ if (typeof value2 === "string") {
2672
+ return quoteString(value2);
2673
+ }
2674
+ if (typeof value2 === "number") {
2675
+ return String(value2);
2676
+ }
2677
+ if (typeof value2 === "object") {
2678
+ return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
2679
+ }
2680
+ return void 0;
2681
+ }
2682
+ function quoteString(value2) {
2683
+ const quotes = {
2684
+ "'": 0.1,
2685
+ '"': 0.2
2686
+ };
2687
+ const replacements = {
2688
+ "'": "\\'",
2689
+ '"': '\\"',
2690
+ "\\": "\\\\",
2691
+ "\b": "\\b",
2692
+ "\f": "\\f",
2693
+ "\n": "\\n",
2694
+ "\r": "\\r",
2695
+ " ": "\\t",
2696
+ "\v": "\\v",
2697
+ "\0": "\\0",
2698
+ "\u2028": "\\u2028",
2699
+ "\u2029": "\\u2029"
2700
+ };
2701
+ let product = "";
2702
+ for (let i = 0; i < value2.length; i++) {
2703
+ const c2 = value2[i];
2704
+ switch (c2) {
2705
+ case "'":
2706
+ case '"':
2707
+ quotes[c2]++;
2708
+ product += c2;
2709
+ continue;
2710
+ case "\0":
2711
+ if (util.isDigit(value2[i + 1])) {
2712
+ product += "\\x00";
2713
+ continue;
2714
+ }
2715
+ }
2716
+ if (replacements[c2]) {
2717
+ product += replacements[c2];
2718
+ continue;
2719
+ }
2720
+ if (c2 < " ") {
2721
+ let hexString = c2.charCodeAt(0).toString(16);
2722
+ product += "\\x" + ("00" + hexString).substring(hexString.length);
2723
+ continue;
2724
+ }
2725
+ product += c2;
2726
+ }
2727
+ const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
2728
+ product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
2729
+ return quoteChar + product + quoteChar;
2730
+ }
2731
+ function serializeObject(value2) {
2732
+ if (stack2.indexOf(value2) >= 0) {
2733
+ throw TypeError("Converting circular structure to JSON5");
2734
+ }
2735
+ stack2.push(value2);
2736
+ let stepback = indent;
2737
+ indent = indent + gap;
2738
+ let keys = propertyList || Object.keys(value2);
2739
+ let partial = [];
2740
+ for (const key2 of keys) {
2741
+ const propertyString = serializeProperty(key2, value2);
2742
+ if (propertyString !== void 0) {
2743
+ let member = serializeKey(key2) + ":";
2744
+ if (gap !== "") {
2745
+ member += " ";
2746
+ }
2747
+ member += propertyString;
2748
+ partial.push(member);
2749
+ }
2750
+ }
2751
+ let final;
2752
+ if (partial.length === 0) {
2753
+ final = "{}";
2754
+ } else {
2755
+ let properties;
2756
+ if (gap === "") {
2757
+ properties = partial.join(",");
2758
+ final = "{" + properties + "}";
2759
+ } else {
2760
+ let separator = ",\n" + indent;
2761
+ properties = partial.join(separator);
2762
+ final = "{\n" + indent + properties + ",\n" + stepback + "}";
2763
+ }
2764
+ }
2765
+ stack2.pop();
2766
+ indent = stepback;
2767
+ return final;
2768
+ }
2769
+ function serializeKey(key2) {
2770
+ if (key2.length === 0) {
2771
+ return quoteString(key2);
2772
+ }
2773
+ const firstChar = String.fromCodePoint(key2.codePointAt(0));
2774
+ if (!util.isIdStartChar(firstChar)) {
2775
+ return quoteString(key2);
2776
+ }
2777
+ for (let i = firstChar.length; i < key2.length; i++) {
2778
+ if (!util.isIdContinueChar(String.fromCodePoint(key2.codePointAt(i)))) {
2779
+ return quoteString(key2);
2780
+ }
2781
+ }
2782
+ return key2;
2783
+ }
2784
+ function serializeArray(value2) {
2785
+ if (stack2.indexOf(value2) >= 0) {
2786
+ throw TypeError("Converting circular structure to JSON5");
2787
+ }
2788
+ stack2.push(value2);
2789
+ let stepback = indent;
2790
+ indent = indent + gap;
2791
+ let partial = [];
2792
+ for (let i = 0; i < value2.length; i++) {
2793
+ const propertyString = serializeProperty(String(i), value2);
2794
+ partial.push(propertyString !== void 0 ? propertyString : "null");
2795
+ }
2796
+ let final;
2797
+ if (partial.length === 0) {
2798
+ final = "[]";
2799
+ } else {
2800
+ if (gap === "") {
2801
+ let properties = partial.join(",");
2802
+ final = "[" + properties + "]";
2803
+ } else {
2804
+ let separator = ",\n" + indent;
2805
+ let properties = partial.join(separator);
2806
+ final = "[\n" + indent + properties + ",\n" + stepback + "]";
2807
+ }
2808
+ }
2809
+ stack2.pop();
2810
+ indent = stepback;
2811
+ return final;
2812
+ }
2813
+ };
2814
+ JSON5 = {
2815
+ parse,
2816
+ stringify
2817
+ };
2818
+ lib = JSON5;
2819
+ dist_default = lib;
2820
+ }
2821
+ });
2822
+
2823
+ // node_modules/strip-bom/index.js
2824
+ var require_strip_bom = __commonJS({
2825
+ "node_modules/strip-bom/index.js"(exports, module) {
2826
+ module.exports = (x) => {
2827
+ if (typeof x !== "string") {
2828
+ throw new TypeError("Expected a string, got " + typeof x);
2829
+ }
2830
+ if (x.charCodeAt(0) === 65279) {
2831
+ return x.slice(1);
2832
+ }
2833
+ return x;
2834
+ };
2835
+ }
2836
+ });
2837
+
2838
+ // node_modules/tsconfig-paths/lib/tsconfig-loader.js
2839
+ var require_tsconfig_loader = __commonJS({
2840
+ "node_modules/tsconfig-paths/lib/tsconfig-loader.js"(exports) {
2841
+ var __assign = exports && exports.__assign || function() {
2842
+ __assign = Object.assign || function(t) {
2843
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2844
+ s = arguments[i];
2845
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2846
+ t[p] = s[p];
2847
+ }
2848
+ return t;
2849
+ };
2850
+ return __assign.apply(this, arguments);
2851
+ };
2852
+ Object.defineProperty(exports, "__esModule", { value: true });
2853
+ exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
2854
+ var path7 = __require("path");
2855
+ var fs3 = __require("fs");
2856
+ var JSON52 = (init_dist(), __toCommonJS(dist_exports));
2857
+ var StripBom = require_strip_bom();
2858
+ function tsConfigLoader(_a) {
2859
+ var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
2860
+ var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
2861
+ var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
2862
+ var loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL);
2863
+ return loadResult;
2864
+ }
2865
+ exports.tsConfigLoader = tsConfigLoader;
2866
+ function loadSyncDefault(cwd, filename, baseUrl) {
2867
+ var configPath = resolveConfigPath(cwd, filename);
2868
+ if (!configPath) {
2869
+ return {
2870
+ tsConfigPath: void 0,
2871
+ baseUrl: void 0,
2872
+ paths: void 0
2873
+ };
2874
+ }
2875
+ var config = loadTsconfig(configPath);
2876
+ return {
2877
+ tsConfigPath: configPath,
2878
+ baseUrl: baseUrl || config && config.compilerOptions && config.compilerOptions.baseUrl,
2879
+ paths: config && config.compilerOptions && config.compilerOptions.paths
2880
+ };
2881
+ }
2882
+ function resolveConfigPath(cwd, filename) {
2883
+ if (filename) {
2884
+ var absolutePath = fs3.lstatSync(filename).isDirectory() ? path7.resolve(filename, "./tsconfig.json") : path7.resolve(cwd, filename);
2885
+ return absolutePath;
2886
+ }
2887
+ if (fs3.statSync(cwd).isFile()) {
2888
+ return path7.resolve(cwd);
2889
+ }
2890
+ var configAbsolutePath = walkForTsConfig(cwd);
2891
+ return configAbsolutePath ? path7.resolve(configAbsolutePath) : void 0;
2892
+ }
2893
+ function walkForTsConfig(directory, readdirSync2) {
2894
+ if (readdirSync2 === void 0) {
2895
+ readdirSync2 = fs3.readdirSync;
2896
+ }
2897
+ var files = readdirSync2(directory);
2898
+ var filesToCheck = ["tsconfig.json", "jsconfig.json"];
2899
+ for (var _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
2900
+ var fileToCheck = filesToCheck_1[_i];
2901
+ if (files.indexOf(fileToCheck) !== -1) {
2902
+ return path7.join(directory, fileToCheck);
2903
+ }
2904
+ }
2905
+ var parentDirectory = path7.dirname(directory);
2906
+ if (directory === parentDirectory) {
2907
+ return void 0;
2908
+ }
2909
+ return walkForTsConfig(parentDirectory, readdirSync2);
2910
+ }
2911
+ exports.walkForTsConfig = walkForTsConfig;
2912
+ function loadTsconfig(configFilePath, existsSync2, readFileSync) {
2913
+ if (existsSync2 === void 0) {
2914
+ existsSync2 = fs3.existsSync;
2915
+ }
2916
+ if (readFileSync === void 0) {
2917
+ readFileSync = function(filename) {
2918
+ return fs3.readFileSync(filename, "utf8");
2919
+ };
2920
+ }
2921
+ if (!existsSync2(configFilePath)) {
2922
+ return void 0;
2923
+ }
2924
+ var configString = readFileSync(configFilePath);
2925
+ var cleanedJson = StripBom(configString);
2926
+ var config;
2927
+ try {
2928
+ config = JSON52.parse(cleanedJson);
2929
+ } catch (e) {
2930
+ throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
2931
+ }
2932
+ var extendedConfig = config.extends;
2933
+ if (extendedConfig) {
2934
+ var base = void 0;
2935
+ if (Array.isArray(extendedConfig)) {
2936
+ base = extendedConfig.reduce(function(currBase, extendedConfigElement) {
2937
+ return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync2, readFileSync));
2938
+ }, {});
2939
+ } else {
2940
+ base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync2, readFileSync);
2941
+ }
2942
+ return mergeTsconfigs(base, config);
2943
+ }
2944
+ return config;
2945
+ }
2946
+ exports.loadTsconfig = loadTsconfig;
2947
+ function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync2, readFileSync) {
2948
+ var _a;
2949
+ if (typeof extendedConfigValue === "string" && extendedConfigValue.indexOf(".json") === -1) {
2950
+ extendedConfigValue += ".json";
2951
+ }
2952
+ var currentDir = path7.dirname(configFilePath);
2953
+ var extendedConfigPath = path7.join(currentDir, extendedConfigValue);
2954
+ if (extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync2(extendedConfigPath)) {
2955
+ extendedConfigPath = path7.join(currentDir, "node_modules", extendedConfigValue);
2956
+ }
2957
+ var config = loadTsconfig(extendedConfigPath, existsSync2, readFileSync) || {};
2958
+ if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
2959
+ var extendsDir = path7.dirname(extendedConfigValue);
2960
+ config.compilerOptions.baseUrl = path7.join(extendsDir, config.compilerOptions.baseUrl);
2961
+ }
2962
+ return config;
2963
+ }
2964
+ function mergeTsconfigs(base, config) {
2965
+ base = base || {};
2966
+ config = config || {};
2967
+ return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
2968
+ }
2969
+ }
2970
+ });
2971
+
2972
+ // node_modules/tsconfig-paths/lib/config-loader.js
2973
+ var require_config_loader = __commonJS({
2974
+ "node_modules/tsconfig-paths/lib/config-loader.js"(exports) {
2975
+ Object.defineProperty(exports, "__esModule", { value: true });
2976
+ exports.configLoader = exports.loadConfig = void 0;
2977
+ var TsConfigLoader2 = require_tsconfig_loader();
2978
+ var path7 = __require("path");
2979
+ function loadConfig2(cwd) {
2980
+ if (cwd === void 0) {
2981
+ cwd = process.cwd();
2982
+ }
2983
+ return configLoader({ cwd });
2984
+ }
2985
+ exports.loadConfig = loadConfig2;
2986
+ function configLoader(_a) {
2987
+ var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
2988
+ if (explicitParams) {
2989
+ var absoluteBaseUrl = path7.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path7.join(cwd, explicitParams.baseUrl);
2990
+ return {
2991
+ resultType: "success",
2992
+ configFileAbsolutePath: "",
2993
+ baseUrl: explicitParams.baseUrl,
2994
+ absoluteBaseUrl,
2995
+ paths: explicitParams.paths,
2996
+ mainFields: explicitParams.mainFields,
2997
+ addMatchAll: explicitParams.addMatchAll
2998
+ };
2999
+ }
3000
+ var loadResult = tsConfigLoader({
3001
+ cwd,
3002
+ getEnv: function(key2) {
3003
+ return process.env[key2];
3004
+ }
3005
+ });
3006
+ if (!loadResult.tsConfigPath) {
3007
+ return {
3008
+ resultType: "failed",
3009
+ message: "Couldn't find tsconfig.json"
3010
+ };
3011
+ }
3012
+ return {
3013
+ resultType: "success",
3014
+ configFileAbsolutePath: loadResult.tsConfigPath,
3015
+ baseUrl: loadResult.baseUrl,
3016
+ absoluteBaseUrl: path7.resolve(path7.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
3017
+ paths: loadResult.paths || {},
3018
+ addMatchAll: loadResult.baseUrl !== void 0
3019
+ };
3020
+ }
3021
+ exports.configLoader = configLoader;
3022
+ }
3023
+ });
3024
+
3025
+ // node_modules/minimist/index.js
3026
+ var require_minimist = __commonJS({
3027
+ "node_modules/minimist/index.js"(exports, module) {
3028
+ function hasKey(obj, keys) {
3029
+ var o = obj;
3030
+ keys.slice(0, -1).forEach(function(key3) {
3031
+ o = o[key3] || {};
3032
+ });
3033
+ var key2 = keys[keys.length - 1];
3034
+ return key2 in o;
3035
+ }
3036
+ function isNumber(x) {
3037
+ if (typeof x === "number") {
3038
+ return true;
3039
+ }
3040
+ if (/^0x[0-9a-f]+$/i.test(x)) {
3041
+ return true;
3042
+ }
3043
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
3044
+ }
3045
+ function isConstructorOrProto(obj, key2) {
3046
+ return key2 === "constructor" && typeof obj[key2] === "function" || key2 === "__proto__";
3047
+ }
3048
+ module.exports = function(args, opts) {
3049
+ if (!opts) {
3050
+ opts = {};
3051
+ }
3052
+ var flags = {
3053
+ bools: {},
3054
+ strings: {},
3055
+ unknownFn: null
3056
+ };
3057
+ if (typeof opts.unknown === "function") {
3058
+ flags.unknownFn = opts.unknown;
3059
+ }
3060
+ if (typeof opts.boolean === "boolean" && opts.boolean) {
3061
+ flags.allBools = true;
3062
+ } else {
3063
+ [].concat(opts.boolean).filter(Boolean).forEach(function(key3) {
3064
+ flags.bools[key3] = true;
3065
+ });
3066
+ }
3067
+ var aliases = {};
3068
+ function aliasIsBoolean(key3) {
3069
+ return aliases[key3].some(function(x) {
3070
+ return flags.bools[x];
3071
+ });
3072
+ }
3073
+ Object.keys(opts.alias || {}).forEach(function(key3) {
3074
+ aliases[key3] = [].concat(opts.alias[key3]);
3075
+ aliases[key3].forEach(function(x) {
3076
+ aliases[x] = [key3].concat(aliases[key3].filter(function(y) {
3077
+ return x !== y;
3078
+ }));
3079
+ });
3080
+ });
3081
+ [].concat(opts.string).filter(Boolean).forEach(function(key3) {
3082
+ flags.strings[key3] = true;
3083
+ if (aliases[key3]) {
3084
+ [].concat(aliases[key3]).forEach(function(k) {
3085
+ flags.strings[k] = true;
3086
+ });
3087
+ }
3088
+ });
3089
+ var defaults = opts.default || {};
3090
+ var argv = { _: [] };
3091
+ function argDefined(key3, arg2) {
3092
+ return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key3] || flags.bools[key3] || aliases[key3];
3093
+ }
3094
+ function setKey(obj, keys, value2) {
3095
+ var o = obj;
3096
+ for (var i2 = 0; i2 < keys.length - 1; i2++) {
3097
+ var key3 = keys[i2];
3098
+ if (isConstructorOrProto(o, key3)) {
3099
+ return;
3100
+ }
3101
+ if (o[key3] === void 0) {
3102
+ o[key3] = {};
3103
+ }
3104
+ if (o[key3] === Object.prototype || o[key3] === Number.prototype || o[key3] === String.prototype) {
3105
+ o[key3] = {};
3106
+ }
3107
+ if (o[key3] === Array.prototype) {
3108
+ o[key3] = [];
3109
+ }
3110
+ o = o[key3];
3111
+ }
3112
+ var lastKey = keys[keys.length - 1];
3113
+ if (isConstructorOrProto(o, lastKey)) {
3114
+ return;
3115
+ }
3116
+ if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
3117
+ o = {};
3118
+ }
3119
+ if (o === Array.prototype) {
3120
+ o = [];
3121
+ }
3122
+ if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
3123
+ o[lastKey] = value2;
3124
+ } else if (Array.isArray(o[lastKey])) {
3125
+ o[lastKey].push(value2);
3126
+ } else {
3127
+ o[lastKey] = [o[lastKey], value2];
3128
+ }
3129
+ }
3130
+ function setArg(key3, val, arg2) {
3131
+ if (arg2 && flags.unknownFn && !argDefined(key3, arg2)) {
3132
+ if (flags.unknownFn(arg2) === false) {
3133
+ return;
3134
+ }
3135
+ }
3136
+ var value2 = !flags.strings[key3] && isNumber(val) ? Number(val) : val;
3137
+ setKey(argv, key3.split("."), value2);
3138
+ (aliases[key3] || []).forEach(function(x) {
3139
+ setKey(argv, x.split("."), value2);
3140
+ });
3141
+ }
3142
+ Object.keys(flags.bools).forEach(function(key3) {
3143
+ setArg(key3, defaults[key3] === void 0 ? false : defaults[key3]);
3144
+ });
3145
+ var notFlags = [];
3146
+ if (args.indexOf("--") !== -1) {
3147
+ notFlags = args.slice(args.indexOf("--") + 1);
3148
+ args = args.slice(0, args.indexOf("--"));
3149
+ }
3150
+ for (var i = 0; i < args.length; i++) {
3151
+ var arg = args[i];
3152
+ var key2;
3153
+ var next;
3154
+ if (/^--.+=/.test(arg)) {
3155
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
3156
+ key2 = m[1];
3157
+ var value = m[2];
3158
+ if (flags.bools[key2]) {
3159
+ value = value !== "false";
3160
+ }
3161
+ setArg(key2, value, arg);
3162
+ } else if (/^--no-.+/.test(arg)) {
3163
+ key2 = arg.match(/^--no-(.+)/)[1];
3164
+ setArg(key2, false, arg);
3165
+ } else if (/^--.+/.test(arg)) {
3166
+ key2 = arg.match(/^--(.+)/)[1];
3167
+ next = args[i + 1];
3168
+ if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key2] && !flags.allBools && (aliases[key2] ? !aliasIsBoolean(key2) : true)) {
3169
+ setArg(key2, next, arg);
3170
+ i += 1;
3171
+ } else if (/^(true|false)$/.test(next)) {
3172
+ setArg(key2, next === "true", arg);
3173
+ i += 1;
3174
+ } else {
3175
+ setArg(key2, flags.strings[key2] ? "" : true, arg);
3176
+ }
3177
+ } else if (/^-[^-]+/.test(arg)) {
3178
+ var letters = arg.slice(1, -1).split("");
3179
+ var broken = false;
3180
+ for (var j = 0; j < letters.length; j++) {
3181
+ next = arg.slice(j + 2);
3182
+ if (next === "-") {
3183
+ setArg(letters[j], next, arg);
3184
+ continue;
3185
+ }
3186
+ if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
3187
+ setArg(letters[j], next.slice(1), arg);
3188
+ broken = true;
3189
+ break;
3190
+ }
3191
+ if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
3192
+ setArg(letters[j], next, arg);
3193
+ broken = true;
3194
+ break;
3195
+ }
3196
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
3197
+ setArg(letters[j], arg.slice(j + 2), arg);
3198
+ broken = true;
3199
+ break;
3200
+ } else {
3201
+ setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
3202
+ }
3203
+ }
3204
+ key2 = arg.slice(-1)[0];
3205
+ if (!broken && key2 !== "-") {
3206
+ if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key2] && (aliases[key2] ? !aliasIsBoolean(key2) : true)) {
3207
+ setArg(key2, args[i + 1], arg);
3208
+ i += 1;
3209
+ } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
3210
+ setArg(key2, args[i + 1] === "true", arg);
3211
+ i += 1;
3212
+ } else {
3213
+ setArg(key2, flags.strings[key2] ? "" : true, arg);
3214
+ }
3215
+ }
3216
+ } else {
3217
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
3218
+ argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
3219
+ }
3220
+ if (opts.stopEarly) {
3221
+ argv._.push.apply(argv._, args.slice(i + 1));
3222
+ break;
3223
+ }
3224
+ }
3225
+ }
3226
+ Object.keys(defaults).forEach(function(k) {
3227
+ if (!hasKey(argv, k.split("."))) {
3228
+ setKey(argv, k.split("."), defaults[k]);
3229
+ (aliases[k] || []).forEach(function(x) {
3230
+ setKey(argv, x.split("."), defaults[k]);
3231
+ });
3232
+ }
3233
+ });
3234
+ if (opts["--"]) {
3235
+ argv["--"] = notFlags.slice();
3236
+ } else {
3237
+ notFlags.forEach(function(k) {
3238
+ argv._.push(k);
3239
+ });
3240
+ }
3241
+ return argv;
3242
+ };
3243
+ }
3244
+ });
3245
+
3246
+ // node_modules/tsconfig-paths/lib/register.js
3247
+ var require_register = __commonJS({
3248
+ "node_modules/tsconfig-paths/lib/register.js"(exports) {
3249
+ var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
3250
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3251
+ if (ar || !(i in from)) {
3252
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3253
+ ar[i] = from[i];
3254
+ }
3255
+ }
3256
+ return to.concat(ar || Array.prototype.slice.call(from));
3257
+ };
3258
+ Object.defineProperty(exports, "__esModule", { value: true });
3259
+ exports.register = void 0;
3260
+ var match_path_sync_1 = require_match_path_sync();
3261
+ var config_loader_1 = require_config_loader();
3262
+ var noOp = function() {
3263
+ return void 0;
3264
+ };
3265
+ function getCoreModules(builtinModules) {
3266
+ builtinModules = builtinModules || [
3267
+ "assert",
3268
+ "buffer",
3269
+ "child_process",
3270
+ "cluster",
3271
+ "crypto",
3272
+ "dgram",
3273
+ "dns",
3274
+ "domain",
3275
+ "events",
3276
+ "fs",
3277
+ "http",
3278
+ "https",
3279
+ "net",
3280
+ "os",
3281
+ "path",
3282
+ "punycode",
3283
+ "querystring",
3284
+ "readline",
3285
+ "stream",
3286
+ "string_decoder",
3287
+ "tls",
3288
+ "tty",
3289
+ "url",
3290
+ "util",
3291
+ "v8",
3292
+ "vm",
3293
+ "zlib"
3294
+ ];
3295
+ var coreModules = {};
3296
+ for (var _i = 0, builtinModules_1 = builtinModules; _i < builtinModules_1.length; _i++) {
3297
+ var module_1 = builtinModules_1[_i];
3298
+ coreModules[module_1] = true;
3299
+ }
3300
+ return coreModules;
3301
+ }
3302
+ function register(params) {
3303
+ var cwd;
3304
+ var explicitParams;
3305
+ if (params) {
3306
+ cwd = params.cwd;
3307
+ if (params.baseUrl || params.paths) {
3308
+ explicitParams = params;
3309
+ }
3310
+ } else {
3311
+ var minimist = require_minimist();
3312
+ var argv = minimist(process.argv.slice(2), {
3313
+ // eslint-disable-next-line id-denylist
3314
+ string: ["project"],
3315
+ alias: {
3316
+ project: ["P"]
3317
+ }
3318
+ });
3319
+ cwd = argv.project;
3320
+ }
3321
+ var configLoaderResult = (0, config_loader_1.configLoader)({
3322
+ cwd: cwd !== null && cwd !== void 0 ? cwd : process.cwd(),
3323
+ explicitParams
3324
+ });
3325
+ if (configLoaderResult.resultType === "failed") {
3326
+ console.warn("".concat(configLoaderResult.message, ". tsconfig-paths will be skipped"));
3327
+ return noOp;
3328
+ }
3329
+ var matchPath = (0, match_path_sync_1.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
3330
+ var Module = __require("module");
3331
+ var originalResolveFilename = Module._resolveFilename;
3332
+ var coreModules = getCoreModules(Module.builtinModules);
3333
+ Module._resolveFilename = function(request, _parent) {
3334
+ var isCoreModule = coreModules.hasOwnProperty(request);
3335
+ if (!isCoreModule) {
3336
+ var found = matchPath(request);
3337
+ if (found) {
3338
+ var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true);
3339
+ return originalResolveFilename.apply(this, modifiedArguments);
3340
+ }
3341
+ }
3342
+ return originalResolveFilename.apply(this, arguments);
3343
+ };
3344
+ return function() {
3345
+ Module._resolveFilename = originalResolveFilename;
3346
+ };
3347
+ }
3348
+ exports.register = register;
3349
+ }
3350
+ });
3351
+
3352
+ // node_modules/tsconfig-paths/lib/index.js
3353
+ var require_lib = __commonJS({
3354
+ "node_modules/tsconfig-paths/lib/index.js"(exports) {
3355
+ Object.defineProperty(exports, "__esModule", { value: true });
3356
+ exports.loadConfig = exports.register = exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
3357
+ var match_path_sync_1 = require_match_path_sync();
3358
+ Object.defineProperty(exports, "createMatchPath", { enumerable: true, get: function() {
3359
+ return match_path_sync_1.createMatchPath;
3360
+ } });
3361
+ Object.defineProperty(exports, "matchFromAbsolutePaths", { enumerable: true, get: function() {
3362
+ return match_path_sync_1.matchFromAbsolutePaths;
3363
+ } });
3364
+ var match_path_async_1 = require_match_path_async();
3365
+ Object.defineProperty(exports, "createMatchPathAsync", { enumerable: true, get: function() {
3366
+ return match_path_async_1.createMatchPathAsync;
3367
+ } });
3368
+ Object.defineProperty(exports, "matchFromAbsolutePathsAsync", { enumerable: true, get: function() {
3369
+ return match_path_async_1.matchFromAbsolutePathsAsync;
3370
+ } });
3371
+ var register_1 = require_register();
3372
+ Object.defineProperty(exports, "register", { enumerable: true, get: function() {
3373
+ return register_1.register;
3374
+ } });
3375
+ var config_loader_1 = require_config_loader();
3376
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function() {
3377
+ return config_loader_1.loadConfig;
3378
+ } });
3379
+ }
3380
+ });
3381
+
3382
+ // src/cli/builders/app/command.ts
3383
+ var build = (compiler) => {
3384
+ compiler.run((err, stats) => {
3385
+ if (err) {
3386
+ console.error("Webpack compilation error:", err);
3387
+ process.exit(1);
3388
+ }
3389
+ if (stats == null ? void 0 : stats.hasErrors()) {
3390
+ console.error(stats.toString({
3391
+ colors: true,
3392
+ errors: true
3393
+ }));
3394
+ process.exit(1);
3395
+ }
3396
+ console.log(stats == null ? void 0 : stats.toString({ colors: true }));
3397
+ compiler.close((closeErr) => {
3398
+ if (closeErr) {
3399
+ console.error("Webpack close error:", closeErr);
3400
+ process.exit(1);
3401
+ }
3402
+ });
3403
+ });
3404
+ };
3405
+ var watch = (compiler) => {
3406
+ const watching = compiler.watch({
3407
+ aggregateTimeout: 300,
3408
+ ignored: /node_modules/
3409
+ }, (err, stats) => {
3410
+ if (err) {
3411
+ console.error("Webpack watch error:", err);
3412
+ process.exit(1);
3413
+ }
3414
+ if (stats == null ? void 0 : stats.hasErrors()) {
3415
+ console.error(stats.toString({
3416
+ colors: true,
3417
+ errors: true
3418
+ }));
3419
+ return;
3420
+ }
3421
+ console.log(stats == null ? void 0 : stats.toString({ colors: true }));
3422
+ });
3423
+ process.on("SIGINT", () => {
3424
+ watching.close(() => {
3425
+ console.log("Webpack watch mode stopped");
3426
+ process.exit(0);
3427
+ });
3428
+ });
3429
+ };
3430
+
3431
+ // src/cli/resolvers/config.ts
3432
+ var import_dotenv = __toESM(require_main());
3433
+
3434
+ // src/core/define.ts
3435
+ function definePlugin(plugin) {
3436
+ return plugin;
3437
+ }
3438
+
3439
+ // src/cli/plugins/dotenv.ts
3440
+ var dotenv_default = definePlugin((options) => {
3441
+ const { vars = {} } = options || {};
3442
+ return {
3443
+ webpack: {
3444
+ plugins: [
3445
+ new webpack__default.default.DefinePlugin({
3446
+ "process.env": JSON.stringify(vars)
3447
+ })
3448
+ ]
3449
+ }
3450
+ };
3451
+ });
3452
+
3453
+ // src/cli/webpack/plugins/WatchPlugin.ts
3454
+ var WatchPlugin = class {
3455
+ key;
3456
+ entry;
3457
+ callback;
3458
+ constructor({ key: key2, entry = {}, callback }) {
3459
+ this.entry = entry;
3460
+ this.callback = callback;
3461
+ this.key = "watch-plugin:" + (key2 || Object.keys(this.entry).join(","));
3462
+ }
3463
+ apply(compiler) {
3464
+ compiler.hooks.watchRun.tapAsync("WatchPlugin", async (compiler2, callback) => {
3465
+ try {
3466
+ const { modifiedFiles = /* @__PURE__ */ new Set() } = compiler2;
3467
+ const has = this.files.size === 0 || Array.from(modifiedFiles).some((file) => this.files.has(file));
3468
+ if (has) {
3469
+ const entry = await this.callback(modifiedFiles);
3470
+ if (entry) {
3471
+ for (const name2 in this.entry) {
3472
+ delete compiler2.options.entry[name2];
3473
+ }
3474
+ for (const name2 in entry) {
3475
+ compiler2.options.entry[name2] = entry[name2];
3476
+ }
3477
+ this.entry = entry;
3478
+ }
3479
+ }
3480
+ callback();
3481
+ } catch (e) {
3482
+ callback(e);
3483
+ }
3484
+ });
3485
+ }
3486
+ get files() {
3487
+ return new Set(Object.values(this.entry).flatMap((value) => Array.isArray(value) ? value : [value]));
3488
+ }
3489
+ };
3490
+ var WatchPlugin_default = WatchPlugin;
3491
+
3492
+ // src/cli/webpack/merge.ts
3493
+ var import_webpack_merge = __toESM(require_dist());
3494
+ var merge_default = (0, import_webpack_merge.mergeWithCustomize)({
3495
+ customizeArray: (a, b, key2) => {
3496
+ if (key2 === "plugins") {
3497
+ const names = /* @__PURE__ */ new Set();
3498
+ return [...a, ...b].filter((plugin) => {
3499
+ var _a;
3500
+ let name2 = (_a = plugin == null ? void 0 : plugin.constructor) == null ? void 0 : _a.name;
3501
+ if (plugin instanceof WatchPlugin_default) {
3502
+ name2 = plugin.key;
3503
+ }
3504
+ if (names.has(name2)) return false;
3505
+ names.add(name2);
3506
+ return true;
3507
+ });
3508
+ }
3509
+ if (key2 === "resolve.plugins") {
3510
+ const names = /* @__PURE__ */ new Set();
3511
+ return [...a, ...b].filter((plugin) => {
3512
+ var _a;
3513
+ const name2 = (_a = plugin == null ? void 0 : plugin.constructor) == null ? void 0 : _a.name;
3514
+ if (names.has(name2)) return false;
3515
+ names.add(name2);
3516
+ return true;
3517
+ });
3518
+ }
3519
+ if (key2 === "module.rules") {
3520
+ const tests = /* @__PURE__ */ new Set();
3521
+ return [...a, ...b].filter((rule) => {
3522
+ var _a;
3523
+ const test = (_a = rule == null ? void 0 : rule.test) == null ? void 0 : _a.toString();
3524
+ if (tests.has(test)) return false;
3525
+ tests.add(test);
3526
+ return true;
3527
+ });
3528
+ }
3529
+ return void 0;
3530
+ }
3531
+ });
3532
+
3533
+ // src/cli/parsers/entrypoint/utils/resolveImport.ts
3534
+ var import_tsconfig_paths = __toESM(require_lib());
3535
+ function findFileWithExtensions(basePath, exts) {
3536
+ for (const ext of exts) {
3537
+ const candidate = basePath + ext;
3538
+ if (fs__default.default.existsSync(candidate)) {
3539
+ return candidate;
3540
+ }
3541
+ }
3542
+ return null;
3543
+ }
3544
+ var resolveImport_default = (importPath, options = {}) => {
3545
+ const { tsconfigPath = "tsconfig.json", baseDir = process.cwd() } = options;
3546
+ const configFile = path__default.default.isAbsolute(tsconfigPath) ? tsconfigPath : path__default.default.resolve(baseDir, tsconfigPath);
3547
+ if (!fs__default.default.existsSync(configFile)) {
3548
+ throw new Error(`Cannot find tsconfig.json at: ${configFile}`);
3549
+ }
3550
+ const tsconfigRaw = ts2__default.default.readConfigFile(configFile, (p) => fs__default.default.readFileSync(p, "utf8"));
3551
+ const parseConfigHost = {
3552
+ fileExists: fs__default.default.existsSync,
3553
+ readFile: (p) => fs__default.default.readFileSync(p, "utf8"),
3554
+ readDirectory: ts2__default.default.sys.readDirectory,
3555
+ useCaseSensitiveFileNames: true
3556
+ };
3557
+ const parsedConfig = ts2__default.default.parseJsonConfigFileContent(
3558
+ tsconfigRaw.config,
3559
+ parseConfigHost,
3560
+ path__default.default.dirname(configFile)
3561
+ );
3562
+ const matchPath = (0, import_tsconfig_paths.createMatchPath)(
3563
+ parsedConfig.options.baseUrl || ".",
3564
+ parsedConfig.options.paths || {}
3565
+ );
3566
+ if (importPath.startsWith(".") || importPath.startsWith("/")) {
3567
+ const resolvedLocal = path__default.default.resolve(baseDir, importPath);
3568
+ if (fs__default.default.existsSync(resolvedLocal)) {
3569
+ return resolvedLocal;
3570
+ }
3571
+ const candidate = resolvedLocal.endsWith(".ts") || resolvedLocal.endsWith(".tsx") ? resolvedLocal : findFileWithExtensions(resolvedLocal, [".ts", ".tsx"]);
3572
+ if (candidate && fs__default.default.existsSync(candidate)) {
3573
+ return candidate;
3574
+ }
3575
+ throw new Error(`File not found at path "${resolvedLocal}" or with .ts/.tsx extensions`);
3576
+ }
3577
+ const aliased = matchPath(importPath);
3578
+ if (aliased && fs__default.default.existsSync(aliased)) {
3579
+ return path__default.default.resolve(aliased);
3580
+ }
3581
+ if (aliased) {
3582
+ const candidate = aliased.endsWith(".ts") || aliased.endsWith(".tsx") ? aliased : findFileWithExtensions(aliased, [".ts", ".tsx"]);
3583
+ if (candidate && fs__default.default.existsSync(candidate)) {
3584
+ return path__default.default.resolve(candidate);
3585
+ }
3586
+ }
3587
+ try {
3588
+ if (importPath === "adnbn") {
3589
+ return importPath;
3590
+ }
3591
+ return __require.resolve(importPath, { paths: [baseDir] });
3592
+ } catch {
3593
+ throw new Error(`Cannot resolve "${importPath}" as a local path, alias, or npm package from "${baseDir}"`);
3594
+ }
3595
+ };
3596
+
3597
+ // src/types/config.ts
3598
+ var Browser = /* @__PURE__ */ ((Browser2) => {
3599
+ Browser2["Chrome"] = "chrome";
3600
+ Browser2["Chromium"] = "chromium";
3601
+ Browser2["Edge"] = "edge";
3602
+ Browser2["Firefox"] = "firefox";
3603
+ Browser2["Opera"] = "opera";
3604
+ Browser2["Safari"] = "safari";
3605
+ return Browser2;
3606
+ })(Browser || {});
3607
+ var Mode = /* @__PURE__ */ ((Mode2) => {
3608
+ Mode2["None"] = "none";
3609
+ Mode2["Development"] = "development";
3610
+ Mode2["Production"] = "production";
3611
+ return Mode2;
3612
+ })(Mode || {});
3613
+
3614
+ // src/cli/parsers/entrypoint/resolvers/core.ts
3615
+ var name = "adnbn";
3616
+ var core_default = () => {
3617
+ const resolvers = [];
3618
+ Object.entries(Browser).forEach(([key2, value]) => {
3619
+ resolvers.push({
3620
+ from: name,
3621
+ target: "Browser",
3622
+ name: key2,
3623
+ value
3624
+ });
3625
+ });
3626
+ Object.entries(Mode).forEach(([key2, value]) => {
3627
+ resolvers.push({
3628
+ from: name,
3629
+ target: "Mode",
3630
+ name: key2,
3631
+ value
3632
+ });
3633
+ });
3634
+ return resolvers;
3635
+ };
3636
+
3637
+ // src/cli/parsers/entrypoint/resolvers/index.ts
3638
+ var resolvers_default = (resolvers) => (form, target, name2) => {
3639
+ var _a;
3640
+ return (_a = [
3641
+ ...resolvers,
3642
+ ...core_default()
3643
+ ].find((resolver) => resolver.from === form && resolver.target === target && resolver.name === name2)) == null ? void 0 : _a.value;
3644
+ };
3645
+
3646
+ // src/cli/parsers/entrypoint/SourceFile.ts
3647
+ var EntryFile = class _EntryFile {
3648
+ constructor(file) {
3649
+ this.file = file;
3650
+ }
3651
+ sourceFile;
3652
+ variables;
3653
+ imports;
3654
+ enums;
3655
+ static make(file) {
3656
+ return new this(file);
3657
+ }
3658
+ getSourceFile() {
3659
+ if (this.sourceFile) {
3660
+ return this.sourceFile;
3661
+ }
3662
+ const sourceCode = fs__default.default.readFileSync(this.file, "utf8");
3663
+ return this.sourceFile = ts2__default.default.createSourceFile(
3664
+ this.file,
3665
+ sourceCode,
3666
+ ts2__default.default.ScriptTarget.ESNext,
3667
+ true
3668
+ );
3669
+ }
3670
+ getImports() {
3671
+ if (this.imports) {
3672
+ return this.imports;
3673
+ }
3674
+ this.imports = /* @__PURE__ */ new Map();
3675
+ const parse3 = (node) => {
3676
+ if (ts2__default.default.isImportDeclaration(node) && node.moduleSpecifier) {
3677
+ const importPath = node.moduleSpecifier.text;
3678
+ if (node.importClause && node.importClause.namedBindings && ts2__default.default.isNamedImports(node.importClause.namedBindings)) {
3679
+ node.importClause.namedBindings.elements.forEach((el) => {
3680
+ var _a;
3681
+ (_a = this.imports) == null ? void 0 : _a.set(el.name.text, resolveImport_default(importPath));
3682
+ });
3683
+ }
3684
+ }
3685
+ ts2__default.default.forEachChild(node, parse3);
3686
+ };
3687
+ parse3(this.getSourceFile());
3688
+ return this.imports;
3689
+ }
3690
+ getEnums() {
3691
+ if (this.enums) {
3692
+ return this.enums;
3693
+ }
3694
+ this.enums = /* @__PURE__ */ new Map();
3695
+ const parse3 = (node) => {
3696
+ var _a;
3697
+ if (ts2__default.default.isEnumDeclaration(node)) {
3698
+ const enumName = node.name.text;
3699
+ const enumProperties = /* @__PURE__ */ new Map();
3700
+ node.members.forEach((member) => {
3701
+ const key2 = member.name.getText();
3702
+ const value = member.initializer ? member.initializer.getText().replace(/['"]/g, "") : key2;
3703
+ enumProperties.set(key2, value);
3704
+ });
3705
+ (_a = this.enums) == null ? void 0 : _a.set(enumName, enumProperties);
3706
+ }
3707
+ ts2__default.default.forEachChild(node, parse3);
3708
+ };
3709
+ parse3(this.getSourceFile());
3710
+ return this.enums;
3711
+ }
3712
+ getVariables() {
3713
+ if (this.variables) {
3714
+ return this.variables;
3715
+ }
3716
+ this.variables = /* @__PURE__ */ new Map();
3717
+ const parse3 = (node) => {
3718
+ var _a, _b, _c, _d;
3719
+ if (ts2__default.default.isVariableStatement(node)) {
3720
+ const isExported = (_a = node.modifiers) == null ? void 0 : _a.some((modifier) => modifier.kind === ts2__default.default.SyntaxKind.ExportKeyword);
3721
+ node.declarationList.declarations.forEach((declaration) => {
3722
+ var _a2;
3723
+ if (ts2__default.default.isIdentifier(declaration.name) && declaration.initializer) {
3724
+ const name2 = declaration.name.text;
3725
+ const value = this.parseNode(declaration.initializer);
3726
+ (_a2 = this.variables) == null ? void 0 : _a2.set(name2, {
3727
+ name: name2,
3728
+ value,
3729
+ exported: isExported || false
3730
+ });
3731
+ }
3732
+ });
3733
+ }
3734
+ if (ts2__default.default.isExportDeclaration(node) && node.exportClause && ts2__default.default.isNamedExports(node.exportClause)) {
3735
+ node.exportClause.elements.forEach((el) => {
3736
+ var _a2, _b2, _c2;
3737
+ const name2 = el.name.text;
3738
+ if ((_a2 = this.variables) == null ? void 0 : _a2.has(name2)) {
3739
+ const variable = (_b2 = this.variables) == null ? void 0 : _b2.get(name2);
3740
+ (_c2 = this.variables) == null ? void 0 : _c2.set(name2, {
3741
+ name: name2,
3742
+ value: variable.value,
3743
+ exported: true
3744
+ });
3745
+ }
3746
+ });
3747
+ }
3748
+ if (ts2__default.default.isExportAssignment(node)) {
3749
+ const expr = node.expression;
3750
+ if (ts2__default.default.isIdentifier(expr) && ((_b = this.variables) == null ? void 0 : _b.has(expr.text))) {
3751
+ const variable = (_c = this.variables) == null ? void 0 : _c.get(expr.text);
3752
+ const name2 = "default";
3753
+ (_d = this.variables) == null ? void 0 : _d.set(name2, {
3754
+ name: name2,
3755
+ value: variable.value,
3756
+ exported: true
3757
+ });
3758
+ }
3759
+ }
3760
+ ts2__default.default.forEachChild(node, parse3);
3761
+ };
3762
+ parse3(this.getSourceFile());
3763
+ return this.variables;
3764
+ }
3765
+ resolveValue(from, target, name2) {
3766
+ return resolvers_default([])(from, target, name2);
3767
+ }
3768
+ findPropertyAccessValue(property) {
3769
+ if (ts2__default.default.isPropertyAccessExpression(property)) {
3770
+ const objectName = property.expression.getText();
3771
+ const propertyName = property.name.getText();
1643
3772
  const varItem = this.getVariables().get(objectName);
1644
3773
  if (varItem) {
1645
3774
  return varItem.value;
@@ -1650,7 +3779,10 @@ var EntryFile = class _EntryFile {
1650
3779
  }
1651
3780
  const importItem = this.getImports().get(objectName);
1652
3781
  if (importItem) {
1653
- console.log("FFF->", importItem, " -> ", propertyName, "->", objectName);
3782
+ const resolverItem = this.resolveValue(importItem, objectName, propertyName);
3783
+ if (resolverItem) {
3784
+ return resolverItem;
3785
+ }
1654
3786
  return _EntryFile.make(importItem).findPropertyAccessValue(property);
1655
3787
  }
1656
3788
  return `${objectName}.${propertyName}`;
@@ -1663,39 +3795,39 @@ var EntryFile = class _EntryFile {
1663
3795
  return void 0;
1664
3796
  }
1665
3797
  switch (node.kind) {
1666
- case ts__default.default.SyntaxKind.StringLiteral:
3798
+ case ts2__default.default.SyntaxKind.StringLiteral:
1667
3799
  return node.text;
1668
- case ts__default.default.SyntaxKind.TrueKeyword:
3800
+ case ts2__default.default.SyntaxKind.TrueKeyword:
1669
3801
  return true;
1670
- case ts__default.default.SyntaxKind.FalseKeyword:
3802
+ case ts2__default.default.SyntaxKind.FalseKeyword:
1671
3803
  return false;
1672
- case ts__default.default.SyntaxKind.NullKeyword:
3804
+ case ts2__default.default.SyntaxKind.NullKeyword:
1673
3805
  return null;
1674
- case ts__default.default.SyntaxKind.NumericLiteral:
3806
+ case ts2__default.default.SyntaxKind.NumericLiteral:
1675
3807
  return parseFloat(node.text);
1676
- case ts__default.default.SyntaxKind.Identifier:
3808
+ case ts2__default.default.SyntaxKind.Identifier:
1677
3809
  return ((_b = (_a = this.variables) == null ? void 0 : _a.get(node.text)) == null ? void 0 : _b.value) ?? node.text;
1678
- case ts__default.default.SyntaxKind.ArrayLiteralExpression:
3810
+ case ts2__default.default.SyntaxKind.ArrayLiteralExpression:
1679
3811
  return node.elements.map(
1680
3812
  (element) => this.parseNode(element)
1681
3813
  );
1682
- case ts__default.default.SyntaxKind.ObjectLiteralExpression:
3814
+ case ts2__default.default.SyntaxKind.ObjectLiteralExpression:
1683
3815
  return node.properties.filter(
1684
- (property) => ts__default.default.isPropertyAssignment(property) || ts__default.default.isShorthandPropertyAssignment(property)
3816
+ (property) => ts2__default.default.isPropertyAssignment(property) || ts2__default.default.isShorthandPropertyAssignment(property)
1685
3817
  ).reduce((acc, property) => {
1686
3818
  var _a2, _b2, _c;
1687
- if (ts__default.default.isComputedPropertyName(property.name)) {
3819
+ if (ts2__default.default.isComputedPropertyName(property.name)) {
1688
3820
  return acc;
1689
3821
  }
1690
- const key = property.name.text;
3822
+ const key2 = property.name.text;
1691
3823
  let value = this.parseNode(property.initializer);
1692
3824
  if (typeof value === "string" && ((_a2 = this.variables) == null ? void 0 : _a2.has(value))) {
1693
3825
  value = (_c = (_b2 = this.variables) == null ? void 0 : _b2.get(value)) == null ? void 0 : _c.value;
1694
3826
  }
1695
- acc[key] = value;
3827
+ acc[key2] = value;
1696
3828
  return acc;
1697
3829
  }, {});
1698
- case ts__default.default.SyntaxKind.PropertyAccessExpression: {
3830
+ case ts2__default.default.SyntaxKind.PropertyAccessExpression: {
1699
3831
  return this.findPropertyAccessValue(node);
1700
3832
  }
1701
3833
  default:
@@ -1720,27 +3852,26 @@ var OptionFile_default = class extends EntryFile {
1720
3852
  return { ...this.getOptionsFromVariables(), ...this.getOptionsFromDefinition() };
1721
3853
  }
1722
3854
  getOptionsFromVariables() {
1723
- return Array.from(this.getVariables().values()).filter(({ name, exported }) => exported && this.properties.includes(name)).reduce((config, { name, value }) => ({ ...config, [name]: value }), {});
3855
+ return Array.from(this.getVariables().values()).filter(({ name: name2, exported }) => exported && this.properties.includes(name2)).reduce((config, { name: name2, value }) => ({ ...config, [name2]: value }), {});
1724
3856
  }
1725
3857
  getOptionsFromDefinition() {
1726
3858
  let options = {};
1727
- console.log("EEEEEE", this.getImports());
1728
- const parse = (node) => {
1729
- if (ts.isExportAssignment(node)) {
3859
+ const parse3 = (node) => {
3860
+ if (ts2__default.default.isExportAssignment(node)) {
1730
3861
  const expr = node.expression;
1731
- if (ts.isCallExpression(expr) && ts.isIdentifier(expr.expression)) {
3862
+ if (ts2__default.default.isCallExpression(expr) && ts2__default.default.isIdentifier(expr.expression)) {
1732
3863
  const functionName = expr.expression.text;
1733
3864
  if (functionName === this.definition && expr.arguments.length > 0) {
1734
3865
  const arg = expr.arguments[0];
1735
- if (ts.isObjectLiteralExpression(arg)) {
3866
+ if (ts2__default.default.isObjectLiteralExpression(arg)) {
1736
3867
  options = this.parseNode(arg);
1737
3868
  }
1738
3869
  }
1739
3870
  }
1740
3871
  }
1741
- ts.forEachChild(node, parse);
3872
+ ts2__default.default.forEachChild(node, parse3);
1742
3873
  };
1743
- parse(this.getSourceFile());
3874
+ parse3(this.getSourceFile());
1744
3875
  return options;
1745
3876
  }
1746
3877
  };
@@ -1756,25 +3887,28 @@ var getBackgroundOptions = (file) => {
1756
3887
  return OptionFile_default.make(file).setDefinition("defineBackground").setProperties([...commonProperties, "persistent"]).getOptions();
1757
3888
  };
1758
3889
  var getRootPath = (to) => {
1759
- return path2__default.default.resolve(process.cwd(), to);
3890
+ return path__default.default.resolve(process.cwd(), to);
1760
3891
  };
1761
- var getConfigFile = (config) => {
1762
- return path2__default.default.join(config.inputDir, config.configFile);
3892
+ var getSharedPath = (config, to) => {
3893
+ return path__default.default.join(config.inputDir, config.srcDir, config.sharedDir, "");
1763
3894
  };
1764
- var getSharedPath = (config) => {
1765
- return path2__default.default.join(config.inputDir, config.srcDir, config.sharedDir);
3895
+ var getAppsPath = (config, to) => {
3896
+ return path__default.default.join(config.inputDir, config.srcDir, config.appsDir, config.app, to ?? "");
1766
3897
  };
1767
- var getAppsPath = (config) => {
1768
- return path2__default.default.join(config.inputDir, config.srcDir, config.appsDir, config.app);
3898
+ var getInputPath = (config, to) => {
3899
+ return path__default.default.join(config.inputDir, to ?? "");
1769
3900
  };
1770
3901
  var getOutputPath = (config) => {
1771
- return path2__default.default.join(config.outputDir, `${config.app}-${config.browser}-mv${config.manifestVersion}`);
3902
+ return path__default.default.join(config.outputDir, `${config.app}-${config.browser}-mv${config.manifestVersion}`);
3903
+ };
3904
+ var getConfigFile = (config) => {
3905
+ return getInputPath(config, config.configFile);
1772
3906
  };
1773
3907
  var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1774
3908
  var findEntrypointFiles = (directory, entrypoint) => {
1775
3909
  const files = [];
1776
3910
  const regex = new RegExp(
1777
- `^(?:.*\\.)?${escapeRegExp(entrypoint)}\\.(ts|tsx|js)$`
3911
+ `^(?:.*\\.)?${escapeRegExp(entrypoint)}\\.(ts|tsx)$`
1778
3912
  );
1779
3913
  const finder = (dir) => {
1780
3914
  let entries;
@@ -1785,12 +3919,12 @@ var findEntrypointFiles = (directory, entrypoint) => {
1785
3919
  return;
1786
3920
  }
1787
3921
  for (const entry of entries) {
1788
- const fullPath = path2__default.default.join(dir, entry.name);
3922
+ const fullPath = path__default.default.join(dir, entry.name);
1789
3923
  if (entry.isDirectory()) {
1790
3924
  if (entry.name === entrypoint || entry.name.endsWith(`.${entrypoint}`)) {
1791
- const possibleIndexFiles = ["index.ts", "index.tsx", "index.js"];
3925
+ const possibleIndexFiles = ["index.ts", "index.tsx"];
1792
3926
  for (const indexFile of possibleIndexFiles) {
1793
- const indexPath = path2__default.default.join(fullPath, indexFile);
3927
+ const indexPath = path__default.default.join(fullPath, indexFile);
1794
3928
  try {
1795
3929
  const stat = fs.statSync(indexPath);
1796
3930
  if (stat.isFile()) {
@@ -1824,10 +3958,10 @@ var resolvePluginHandler = async (handler, options) => {
1824
3958
  }
1825
3959
  return handler;
1826
3960
  };
1827
- var processPluginHandler = async function* (config, key, options) {
3961
+ var processPluginHandler = async function* (config, key2, options) {
1828
3962
  const { plugins = [] } = config;
1829
3963
  for await (const plugin of plugins) {
1830
- const handler = plugin[key];
3964
+ const handler = plugin[key2];
1831
3965
  const result = await resolvePluginHandler(handler, options);
1832
3966
  if (result !== void 0) {
1833
3967
  yield { name: plugin.name, result };
@@ -1846,10 +3980,17 @@ var isValidEntrypointOptions = (options, config) => {
1846
3980
  };
1847
3981
 
1848
3982
  // src/cli/plugins/background/background.ts
3983
+ function shortenPath(filePath) {
3984
+ const { dir, name: name2, ext, base } = path__default.default.parse(filePath);
3985
+ if (name2 === "index" && (ext === ".ts" || ext === ".tsx")) {
3986
+ return dir;
3987
+ }
3988
+ return path__default.default.join(dir, name2);
3989
+ }
1849
3990
  var backgroundFilesToEntries = (files) => {
1850
3991
  const entries = /* @__PURE__ */ new Map();
1851
3992
  for (const file of files) {
1852
- entries.set(file, getBackgroundOptions(file));
3993
+ entries.set(shortenPath(file), getBackgroundOptions(file));
1853
3994
  }
1854
3995
  return entries;
1855
3996
  };
@@ -1879,11 +4020,11 @@ var getBackgroundEntries = async (config) => {
1879
4020
  entries
1880
4021
  }));
1881
4022
  if (pluginBackgroundResult.length > 0) {
1882
- const pluginBackgroundFiles = pluginBackgroundResult.map(({ name, result: endpoint }) => {
4023
+ const pluginBackgroundFiles = pluginBackgroundResult.map(({ name: name2, result: endpoint }) => {
1883
4024
  if (___default.default.isBoolean(endpoint)) {
1884
4025
  endpoint = "background";
1885
4026
  }
1886
- return __require.resolve(`${name}/${endpoint}`);
4027
+ return __require.resolve(`${name2}/${endpoint}`);
1887
4028
  });
1888
4029
  const pluginBackgroundEntries = backgroundFilesToEntries(pluginBackgroundFiles);
1889
4030
  entries = new Map([...entries, ...pluginBackgroundEntries]);
@@ -1901,9 +4042,7 @@ var background_default = async (config) => {
1901
4042
  };
1902
4043
 
1903
4044
  // raw-loader:./background.ts?raw
1904
- var background_default2 = `import {BackgroundDefinition} from "adnbn";
1905
-
1906
- import * as module from "virtual:background-entrypoint";
4045
+ var background_default2 = `import * as module from "virtual:background-entrypoint";
1907
4046
 
1908
4047
  import _isFunction from "lodash/isFunction";
1909
4048
  import _isPlainObject from "lodash/isPlainObject";
@@ -1911,7 +4050,7 @@ import _isPlainObject from "lodash/isPlainObject";
1911
4050
  try {
1912
4051
  const {default: defaultDefinition, ...otherDefinition} = module;
1913
4052
 
1914
- let definition: BackgroundDefinition = otherDefinition;
4053
+ let definition = otherDefinition;
1915
4054
 
1916
4055
  if (_isPlainObject(defaultDefinition)) {
1917
4056
  definition = {...definition, ...defaultDefinition};
@@ -1919,6 +4058,7 @@ try {
1919
4058
  definition = {...definition, main: defaultDefinition};
1920
4059
  }
1921
4060
 
4061
+ // @ts-ignore
1922
4062
  const {main, ...options} = definition;
1923
4063
 
1924
4064
  if (_isFunction(main)) {
@@ -1934,13 +4074,13 @@ try {
1934
4074
  // src/cli/virtual/index.ts
1935
4075
  console.log(background_default2);
1936
4076
  var getVirtualModule = (file, template) => {
1937
- return background_default2.replace(`virtual:${template}-entrypoint`, file.replace(".ts", ""));
4077
+ return background_default2.replace(`virtual:${template}-entrypoint`, file);
1938
4078
  };
1939
4079
  var virtualBackgroundModule = (file) => {
1940
4080
  return getVirtualModule(file, "background");
1941
4081
  };
1942
4082
  var background_default3 = definePlugin((options) => {
1943
- const { name = "background" } = options || {};
4083
+ const { name: name2 = "background" } = options || {};
1944
4084
  let hasBackground = false;
1945
4085
  let persistent;
1946
4086
  return {
@@ -1956,10 +4096,10 @@ var background_default3 = definePlugin((options) => {
1956
4096
  }
1957
4097
  hasBackground = true;
1958
4098
  persistent = backgroundPersistent;
1959
- const m = files.reduce((m2, file) => ({ ...m2, [path2__default.default.join("virtual", file)]: virtualBackgroundModule(file) }), {});
4099
+ const m = files.reduce((m2, file) => ({ ...m2, [path__default.default.join("virtual", file)]: virtualBackgroundModule(file) }), {});
1960
4100
  console.log("m", m);
1961
4101
  const virtualModules = new VirtualModulesPlugin__default.default(m);
1962
- const entry = { [name]: Object.keys(m) };
4102
+ const entry = { [name2]: Object.keys(m) };
1963
4103
  let resolvedWebpack = {
1964
4104
  entry,
1965
4105
  plugins: [virtualModules],
@@ -1971,7 +4111,7 @@ var background_default3 = definePlugin((options) => {
1971
4111
  if (___default.default.isFunction(chunks) && !chunks(chunk)) {
1972
4112
  return false;
1973
4113
  }
1974
- return chunk.name !== name;
4114
+ return chunk.name !== name2;
1975
4115
  }
1976
4116
  }
1977
4117
  }
@@ -1980,7 +4120,7 @@ var background_default3 = definePlugin((options) => {
1980
4120
  resolvedWebpack = merge_default(resolvedWebpack, {
1981
4121
  plugins: [
1982
4122
  new WatchPlugin_default({
1983
- key: name,
4123
+ key: name2,
1984
4124
  entry,
1985
4125
  callback: async () => {
1986
4126
  const {
@@ -1991,7 +4131,7 @@ var background_default3 = definePlugin((options) => {
1991
4131
  for (const file of files) {
1992
4132
  virtualModules.writeModule(file, `console.log("${file}")`);
1993
4133
  }
1994
- return { [name]: backgroundFiles2 };
4134
+ return { [name2]: backgroundFiles2 };
1995
4135
  }
1996
4136
  })
1997
4137
  ]
@@ -2002,7 +4142,7 @@ var background_default3 = definePlugin((options) => {
2002
4142
  manifest: ({ manifest }) => {
2003
4143
  if (hasBackground) {
2004
4144
  manifest.resetBackground({
2005
- entry: name,
4145
+ entry: name2,
2006
4146
  persistent
2007
4147
  });
2008
4148
  }
@@ -2039,13 +4179,8 @@ var updateLocalDotenv = (config) => {
2039
4179
  return localVars;
2040
4180
  };
2041
4181
  var loadDotenv = (config) => {
2042
- const { mode, app, browser } = config;
2043
- const paths = [
2044
- `.env.${mode}.${app}.${browser}.local`,
2045
- `.env.${mode}.${app}.${browser}`,
2046
- `.env.${app}.${browser}.local`,
2047
- `.env.${app}.${browser}`,
2048
- `.env.${app}`,
4182
+ const { mode, browser } = config;
4183
+ const preset = [
2049
4184
  `.env.${mode}.${browser}.local`,
2050
4185
  `.env.${mode}.${browser}`,
2051
4186
  `.env.${browser}.local`,
@@ -2054,7 +4189,10 @@ var loadDotenv = (config) => {
2054
4189
  `.env.${mode}`,
2055
4190
  `.env.local`,
2056
4191
  `.env`
2057
- ].map((file) => path2__default.default.join(getRootPath(config.inputDir), file));
4192
+ ];
4193
+ const appPaths = preset.map((file) => getAppsPath(config, file));
4194
+ const rootPaths = preset.map((file) => getInputPath(config, file));
4195
+ const paths = [...appPaths, ...rootPaths];
2058
4196
  const { parsed: fileVars = {} } = import_dotenv.default.config({ path: paths });
2059
4197
  return { ...fileVars, ...updateLocalDotenv(config) };
2060
4198
  };
@@ -2139,8 +4277,8 @@ var ManifestBase_default = class {
2139
4277
  background;
2140
4278
  contentScripts = /* @__PURE__ */ new Map();
2141
4279
  dependencies = /* @__PURE__ */ new Map();
2142
- setName(name) {
2143
- this.name = name;
4280
+ setName(name2) {
4281
+ this.name = name2;
2144
4282
  return this;
2145
4283
  }
2146
4284
  setShortName(shortName) {
@@ -2170,7 +4308,7 @@ var ManifestBase_default = class {
2170
4308
  return this;
2171
4309
  }
2172
4310
  marge(manifest, ...sources) {
2173
- sources = sources.filter((source) => source !== void 0);
4311
+ sources = sources.filter((source2) => source2 !== void 0);
2174
4312
  if (sources.length === 0) {
2175
4313
  return manifest;
2176
4314
  }
@@ -2366,8 +4504,8 @@ var webpack_default = async (command, config) => {
2366
4504
  cache: false,
2367
4505
  output: {
2368
4506
  path: getRootPath(getOutputPath(config)),
2369
- filename: path2__default.default.join(config.jsDir, "[name].js"),
2370
- assetModuleFilename: path2__default.default.join(config.assetsDir, "[name]-[hash:4][ext]")
4507
+ filename: path__default.default.join(config.jsDir, "[name].js"),
4508
+ assetModuleFilename: path__default.default.join(config.assetsDir, "[name]-[hash:4][ext]")
2371
4509
  },
2372
4510
  resolve: {
2373
4511
  extensions: [".ts", ".tsx", ".js", ".scss"],
@@ -2439,7 +4577,7 @@ var app_default = async (command, config) => {
2439
4577
  };
2440
4578
 
2441
4579
  // package.json
2442
- var version = "0.0.17";
4580
+ var version = "0.0.19";
2443
4581
 
2444
4582
  // src/cli/index.ts
2445
4583
  var cli = cac__default.default("adnbn");
@@ -2447,25 +4585,25 @@ cli.option("--debug", "Enable debug mode");
2447
4585
  cli.command("init", "Initialize a new project").action(() => {
2448
4586
  console.log("init is good in cli");
2449
4587
  });
2450
- cli.command("watch [root]", "Start watch mode").option("-m, --mode <mode>", "Set env mode", { default: "development" }).option("-c, --config <config>", "Path to config file").option("-a, --app <app>", "Specify an app to run", { default: "myapp" }).option("-b, --browser <browser>", "Specify a browser").option("--mv2", "Target manifest v2").action(async (root, options) => {
4588
+ cli.command("watch [root]", "Start watch mode").option("-m, --mode <mode>", "Set env mode", { default: "development" }).option("-c, --config <config>", "Path to config file").option("-a, --app <app>", "Specify an app to run", { default: "myapp" }).option("-b, --browser <browser>", "Specify a browser").option("--mv2", "Target manifest v2").action(async (root2, options) => {
2451
4589
  await app_default("watch" /* Watch */, {
2452
4590
  mode: options.mode,
2453
4591
  debug: options.debug,
2454
4592
  app: options.app,
2455
4593
  browser: options.browser,
2456
4594
  manifestVersion: options.mv2 ? 2 : 3,
2457
- inputDir: root,
4595
+ inputDir: root2,
2458
4596
  configFile: options.config
2459
4597
  });
2460
4598
  });
2461
- cli.command("build [root]", "Build for production").option("-m, --mode <mode>", "Set env mode", { default: "production" }).option("-c, --config <config>", "Path to config file").option("-a, --app <app>", "Specify an app to run", { default: "myapp" }).option("-b, --browser <browser>", "Specify a browser", { default: "chrome" /* Chrome */ }).option("--mv2", "Target manifest v2").option("--analyze", "Visualize extension bundle").action(async (root, options) => {
4599
+ cli.command("build [root]", "Build for production").option("-m, --mode <mode>", "Set env mode", { default: "production" }).option("-c, --config <config>", "Path to config file").option("-a, --app <app>", "Specify an app to run", { default: "myapp" }).option("-b, --browser <browser>", "Specify a browser", { default: "chrome" /* Chrome */ }).option("--mv2", "Target manifest v2").option("--analyze", "Visualize extension bundle").action(async (root2, options) => {
2462
4600
  await app_default("build" /* Build */, {
2463
4601
  mode: options.mode,
2464
4602
  debug: options.debug,
2465
4603
  app: options.app,
2466
4604
  browser: options.browser,
2467
4605
  manifestVersion: options.mv2 ? 2 : 3,
2468
- inputDir: root,
4606
+ inputDir: root2,
2469
4607
  configFile: options.config,
2470
4608
  analyze: options.analyze
2471
4609
  });