shallok 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -109,7 +109,7 @@ var require_path = __commonJS({
109
109
  Object.defineProperty(exports, "__esModule", { value: true });
110
110
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
111
111
  var os = __require("os");
112
- var path14 = __require("path");
112
+ var path18 = __require("path");
113
113
  var IS_WINDOWS_PLATFORM = os.platform() === "win32";
114
114
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
115
115
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
@@ -121,7 +121,7 @@ var require_path = __commonJS({
121
121
  }
122
122
  exports.unixify = unixify;
123
123
  function makeAbsolute(cwd, filepath) {
124
- return path14.resolve(cwd, filepath);
124
+ return path18.resolve(cwd, filepath);
125
125
  }
126
126
  exports.makeAbsolute = makeAbsolute;
127
127
  function removeLeadingDotSegment(entry) {
@@ -1420,7 +1420,7 @@ var require_braces = __commonJS({
1420
1420
  var require_constants2 = __commonJS({
1421
1421
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
1422
1422
  "use strict";
1423
- var path14 = __require("path");
1423
+ var path18 = __require("path");
1424
1424
  var WIN_SLASH = "\\\\/";
1425
1425
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1426
1426
  var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -1594,7 +1594,7 @@ var require_constants2 = __commonJS({
1594
1594
  /* | */
1595
1595
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1596
1596
  /* \uFEFF */
1597
- SEP: path14.sep,
1597
+ SEP: path18.sep,
1598
1598
  /**
1599
1599
  * Create EXTGLOB_CHARS
1600
1600
  */
@@ -1621,7 +1621,7 @@ var require_constants2 = __commonJS({
1621
1621
  var require_utils2 = __commonJS({
1622
1622
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
1623
1623
  "use strict";
1624
- var path14 = __require("path");
1624
+ var path18 = __require("path");
1625
1625
  var win32 = process.platform === "win32";
1626
1626
  var {
1627
1627
  REGEX_BACKSLASH,
@@ -1650,7 +1650,7 @@ var require_utils2 = __commonJS({
1650
1650
  if (options && typeof options.windows === "boolean") {
1651
1651
  return options.windows;
1652
1652
  }
1653
- return win32 === true || path14.sep === "\\";
1653
+ return win32 === true || path18.sep === "\\";
1654
1654
  };
1655
1655
  exports.escapeLast = (input, char, lastIdx) => {
1656
1656
  const idx = input.lastIndexOf(char, lastIdx);
@@ -3014,7 +3014,7 @@ var require_parse2 = __commonJS({
3014
3014
  var require_picomatch = __commonJS({
3015
3015
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
3016
3016
  "use strict";
3017
- var path14 = __require("path");
3017
+ var path18 = __require("path");
3018
3018
  var scan = require_scan();
3019
3019
  var parse3 = require_parse2();
3020
3020
  var utils = require_utils2();
@@ -3099,7 +3099,7 @@ var require_picomatch = __commonJS({
3099
3099
  };
3100
3100
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3101
3101
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
3102
- return regex.test(path14.basename(input));
3102
+ return regex.test(path18.basename(input));
3103
3103
  };
3104
3104
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3105
3105
  picomatch.parse = (pattern, options) => {
@@ -3326,7 +3326,7 @@ var require_pattern = __commonJS({
3326
3326
  "use strict";
3327
3327
  Object.defineProperty(exports, "__esModule", { value: true });
3328
3328
  exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
3329
- var path14 = __require("path");
3329
+ var path18 = __require("path");
3330
3330
  var globParent = require_glob_parent();
3331
3331
  var micromatch = require_micromatch();
3332
3332
  var GLOBSTAR = "**";
@@ -3421,7 +3421,7 @@ var require_pattern = __commonJS({
3421
3421
  }
3422
3422
  exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
3423
3423
  function isAffectDepthOfReadingPattern(pattern) {
3424
- const basename = path14.basename(pattern);
3424
+ const basename = path18.basename(pattern);
3425
3425
  return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
3426
3426
  }
3427
3427
  exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
@@ -3479,7 +3479,7 @@ var require_pattern = __commonJS({
3479
3479
  }
3480
3480
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
3481
3481
  function isAbsolute(pattern) {
3482
- return path14.isAbsolute(pattern);
3482
+ return path18.isAbsolute(pattern);
3483
3483
  }
3484
3484
  exports.isAbsolute = isAbsolute;
3485
3485
  }
@@ -3654,10 +3654,10 @@ var require_utils3 = __commonJS({
3654
3654
  exports.array = array;
3655
3655
  var errno = require_errno();
3656
3656
  exports.errno = errno;
3657
- var fs12 = require_fs();
3658
- exports.fs = fs12;
3659
- var path14 = require_path();
3660
- exports.path = path14;
3657
+ var fs16 = require_fs();
3658
+ exports.fs = fs16;
3659
+ var path18 = require_path();
3660
+ exports.path = path18;
3661
3661
  var pattern = require_pattern();
3662
3662
  exports.pattern = pattern;
3663
3663
  var stream = require_stream();
@@ -3769,8 +3769,8 @@ var require_async = __commonJS({
3769
3769
  "use strict";
3770
3770
  Object.defineProperty(exports, "__esModule", { value: true });
3771
3771
  exports.read = void 0;
3772
- function read(path14, settings, callback) {
3773
- settings.fs.lstat(path14, (lstatError, lstat) => {
3772
+ function read(path18, settings, callback) {
3773
+ settings.fs.lstat(path18, (lstatError, lstat) => {
3774
3774
  if (lstatError !== null) {
3775
3775
  callFailureCallback(callback, lstatError);
3776
3776
  return;
@@ -3779,7 +3779,7 @@ var require_async = __commonJS({
3779
3779
  callSuccessCallback(callback, lstat);
3780
3780
  return;
3781
3781
  }
3782
- settings.fs.stat(path14, (statError, stat) => {
3782
+ settings.fs.stat(path18, (statError, stat) => {
3783
3783
  if (statError !== null) {
3784
3784
  if (settings.throwErrorOnBrokenSymbolicLink) {
3785
3785
  callFailureCallback(callback, statError);
@@ -3811,13 +3811,13 @@ var require_sync = __commonJS({
3811
3811
  "use strict";
3812
3812
  Object.defineProperty(exports, "__esModule", { value: true });
3813
3813
  exports.read = void 0;
3814
- function read(path14, settings) {
3815
- const lstat = settings.fs.lstatSync(path14);
3814
+ function read(path18, settings) {
3815
+ const lstat = settings.fs.lstatSync(path18);
3816
3816
  if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
3817
3817
  return lstat;
3818
3818
  }
3819
3819
  try {
3820
- const stat = settings.fs.statSync(path14);
3820
+ const stat = settings.fs.statSync(path18);
3821
3821
  if (settings.markSymbolicLink) {
3822
3822
  stat.isSymbolicLink = () => true;
3823
3823
  }
@@ -3839,12 +3839,12 @@ var require_fs2 = __commonJS({
3839
3839
  "use strict";
3840
3840
  Object.defineProperty(exports, "__esModule", { value: true });
3841
3841
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
3842
- var fs12 = __require("fs");
3842
+ var fs16 = __require("fs");
3843
3843
  exports.FILE_SYSTEM_ADAPTER = {
3844
- lstat: fs12.lstat,
3845
- stat: fs12.stat,
3846
- lstatSync: fs12.lstatSync,
3847
- statSync: fs12.statSync
3844
+ lstat: fs16.lstat,
3845
+ stat: fs16.stat,
3846
+ lstatSync: fs16.lstatSync,
3847
+ statSync: fs16.statSync
3848
3848
  };
3849
3849
  function createFileSystemAdapter(fsMethods) {
3850
3850
  if (fsMethods === void 0) {
@@ -3861,12 +3861,12 @@ var require_settings = __commonJS({
3861
3861
  "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
3862
3862
  "use strict";
3863
3863
  Object.defineProperty(exports, "__esModule", { value: true });
3864
- var fs12 = require_fs2();
3864
+ var fs16 = require_fs2();
3865
3865
  var Settings = class {
3866
3866
  constructor(_options = {}) {
3867
3867
  this._options = _options;
3868
3868
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
3869
- this.fs = fs12.createFileSystemAdapter(this._options.fs);
3869
+ this.fs = fs16.createFileSystemAdapter(this._options.fs);
3870
3870
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
3871
3871
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
3872
3872
  }
@@ -3888,17 +3888,17 @@ var require_out = __commonJS({
3888
3888
  var sync = require_sync();
3889
3889
  var settings_1 = require_settings();
3890
3890
  exports.Settings = settings_1.default;
3891
- function stat(path14, optionsOrSettingsOrCallback, callback) {
3891
+ function stat(path18, optionsOrSettingsOrCallback, callback) {
3892
3892
  if (typeof optionsOrSettingsOrCallback === "function") {
3893
- async.read(path14, getSettings(), optionsOrSettingsOrCallback);
3893
+ async.read(path18, getSettings(), optionsOrSettingsOrCallback);
3894
3894
  return;
3895
3895
  }
3896
- async.read(path14, getSettings(optionsOrSettingsOrCallback), callback);
3896
+ async.read(path18, getSettings(optionsOrSettingsOrCallback), callback);
3897
3897
  }
3898
3898
  exports.stat = stat;
3899
- function statSync(path14, optionsOrSettings) {
3899
+ function statSync(path18, optionsOrSettings) {
3900
3900
  const settings = getSettings(optionsOrSettings);
3901
- return sync.read(path14, settings);
3901
+ return sync.read(path18, settings);
3902
3902
  }
3903
3903
  exports.statSync = statSync;
3904
3904
  function getSettings(settingsOrOptions = {}) {
@@ -4023,8 +4023,8 @@ var require_utils4 = __commonJS({
4023
4023
  "use strict";
4024
4024
  Object.defineProperty(exports, "__esModule", { value: true });
4025
4025
  exports.fs = void 0;
4026
- var fs12 = require_fs3();
4027
- exports.fs = fs12;
4026
+ var fs16 = require_fs3();
4027
+ exports.fs = fs16;
4028
4028
  }
4029
4029
  });
4030
4030
 
@@ -4116,16 +4116,16 @@ var require_async2 = __commonJS({
4116
4116
  return;
4117
4117
  }
4118
4118
  const tasks = names.map((name) => {
4119
- const path14 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
4119
+ const path18 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
4120
4120
  return (done) => {
4121
- fsStat.stat(path14, settings.fsStatSettings, (error, stats) => {
4121
+ fsStat.stat(path18, settings.fsStatSettings, (error, stats) => {
4122
4122
  if (error !== null) {
4123
4123
  done(error);
4124
4124
  return;
4125
4125
  }
4126
4126
  const entry = {
4127
4127
  name,
4128
- path: path14,
4128
+ path: path18,
4129
4129
  dirent: utils.fs.createDirentFromStats(name, stats)
4130
4130
  };
4131
4131
  if (settings.stats) {
@@ -4219,14 +4219,14 @@ var require_fs4 = __commonJS({
4219
4219
  "use strict";
4220
4220
  Object.defineProperty(exports, "__esModule", { value: true });
4221
4221
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4222
- var fs12 = __require("fs");
4222
+ var fs16 = __require("fs");
4223
4223
  exports.FILE_SYSTEM_ADAPTER = {
4224
- lstat: fs12.lstat,
4225
- stat: fs12.stat,
4226
- lstatSync: fs12.lstatSync,
4227
- statSync: fs12.statSync,
4228
- readdir: fs12.readdir,
4229
- readdirSync: fs12.readdirSync
4224
+ lstat: fs16.lstat,
4225
+ stat: fs16.stat,
4226
+ lstatSync: fs16.lstatSync,
4227
+ statSync: fs16.statSync,
4228
+ readdir: fs16.readdir,
4229
+ readdirSync: fs16.readdirSync
4230
4230
  };
4231
4231
  function createFileSystemAdapter(fsMethods) {
4232
4232
  if (fsMethods === void 0) {
@@ -4243,15 +4243,15 @@ var require_settings2 = __commonJS({
4243
4243
  "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
4244
4244
  "use strict";
4245
4245
  Object.defineProperty(exports, "__esModule", { value: true });
4246
- var path14 = __require("path");
4246
+ var path18 = __require("path");
4247
4247
  var fsStat = require_out();
4248
- var fs12 = require_fs4();
4248
+ var fs16 = require_fs4();
4249
4249
  var Settings = class {
4250
4250
  constructor(_options = {}) {
4251
4251
  this._options = _options;
4252
4252
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
4253
- this.fs = fs12.createFileSystemAdapter(this._options.fs);
4254
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path14.sep);
4253
+ this.fs = fs16.createFileSystemAdapter(this._options.fs);
4254
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path18.sep);
4255
4255
  this.stats = this._getValue(this._options.stats, false);
4256
4256
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
4257
4257
  this.fsStatSettings = new fsStat.Settings({
@@ -4278,17 +4278,17 @@ var require_out2 = __commonJS({
4278
4278
  var sync = require_sync2();
4279
4279
  var settings_1 = require_settings2();
4280
4280
  exports.Settings = settings_1.default;
4281
- function scandir(path14, optionsOrSettingsOrCallback, callback) {
4281
+ function scandir(path18, optionsOrSettingsOrCallback, callback) {
4282
4282
  if (typeof optionsOrSettingsOrCallback === "function") {
4283
- async.read(path14, getSettings(), optionsOrSettingsOrCallback);
4283
+ async.read(path18, getSettings(), optionsOrSettingsOrCallback);
4284
4284
  return;
4285
4285
  }
4286
- async.read(path14, getSettings(optionsOrSettingsOrCallback), callback);
4286
+ async.read(path18, getSettings(optionsOrSettingsOrCallback), callback);
4287
4287
  }
4288
4288
  exports.scandir = scandir;
4289
- function scandirSync(path14, optionsOrSettings) {
4289
+ function scandirSync(path18, optionsOrSettings) {
4290
4290
  const settings = getSettings(optionsOrSettings);
4291
- return sync.read(path14, settings);
4291
+ return sync.read(path18, settings);
4292
4292
  }
4293
4293
  exports.scandirSync = scandirSync;
4294
4294
  function getSettings(settingsOrOptions = {}) {
@@ -4936,7 +4936,7 @@ var require_settings3 = __commonJS({
4936
4936
  "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports) {
4937
4937
  "use strict";
4938
4938
  Object.defineProperty(exports, "__esModule", { value: true });
4939
- var path14 = __require("path");
4939
+ var path18 = __require("path");
4940
4940
  var fsScandir = require_out2();
4941
4941
  var Settings = class {
4942
4942
  constructor(_options = {}) {
@@ -4946,7 +4946,7 @@ var require_settings3 = __commonJS({
4946
4946
  this.deepFilter = this._getValue(this._options.deepFilter, null);
4947
4947
  this.entryFilter = this._getValue(this._options.entryFilter, null);
4948
4948
  this.errorFilter = this._getValue(this._options.errorFilter, null);
4949
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path14.sep);
4949
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path18.sep);
4950
4950
  this.fsScandirSettings = new fsScandir.Settings({
4951
4951
  followSymbolicLinks: this._options.followSymbolicLinks,
4952
4952
  fs: this._options.fs,
@@ -5008,7 +5008,7 @@ var require_reader2 = __commonJS({
5008
5008
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js"(exports) {
5009
5009
  "use strict";
5010
5010
  Object.defineProperty(exports, "__esModule", { value: true });
5011
- var path14 = __require("path");
5011
+ var path18 = __require("path");
5012
5012
  var fsStat = require_out();
5013
5013
  var utils = require_utils3();
5014
5014
  var Reader = class {
@@ -5021,7 +5021,7 @@ var require_reader2 = __commonJS({
5021
5021
  });
5022
5022
  }
5023
5023
  _getFullEntryPath(filepath) {
5024
- return path14.resolve(this._settings.cwd, filepath);
5024
+ return path18.resolve(this._settings.cwd, filepath);
5025
5025
  }
5026
5026
  _makeEntry(stats, pattern) {
5027
5027
  const entry = {
@@ -5437,7 +5437,7 @@ var require_provider = __commonJS({
5437
5437
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js"(exports) {
5438
5438
  "use strict";
5439
5439
  Object.defineProperty(exports, "__esModule", { value: true });
5440
- var path14 = __require("path");
5440
+ var path18 = __require("path");
5441
5441
  var deep_1 = require_deep();
5442
5442
  var entry_1 = require_entry();
5443
5443
  var error_1 = require_error();
@@ -5451,7 +5451,7 @@ var require_provider = __commonJS({
5451
5451
  this.entryTransformer = new entry_2.default(this._settings);
5452
5452
  }
5453
5453
  _getRootDirectory(task) {
5454
- return path14.resolve(this._settings.cwd, task.base);
5454
+ return path18.resolve(this._settings.cwd, task.base);
5455
5455
  }
5456
5456
  _getReaderOptions(task) {
5457
5457
  const basePath = task.base === "." ? "" : task.base;
@@ -5632,16 +5632,16 @@ var require_settings4 = __commonJS({
5632
5632
  "use strict";
5633
5633
  Object.defineProperty(exports, "__esModule", { value: true });
5634
5634
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
5635
- var fs12 = __require("fs");
5635
+ var fs16 = __require("fs");
5636
5636
  var os = __require("os");
5637
5637
  var CPU_COUNT = Math.max(os.cpus().length, 1);
5638
5638
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
5639
- lstat: fs12.lstat,
5640
- lstatSync: fs12.lstatSync,
5641
- stat: fs12.stat,
5642
- statSync: fs12.statSync,
5643
- readdir: fs12.readdir,
5644
- readdirSync: fs12.readdirSync
5639
+ lstat: fs16.lstat,
5640
+ lstatSync: fs16.lstatSync,
5641
+ stat: fs16.stat,
5642
+ statSync: fs16.statSync,
5643
+ readdir: fs16.readdir,
5644
+ readdirSync: fs16.readdirSync
5645
5645
  };
5646
5646
  var Settings = class {
5647
5647
  constructor(_options = {}) {
@@ -20831,11 +20831,11 @@ var require_visitors = __commonJS({
20831
20831
  }
20832
20832
  visitor._verified = true;
20833
20833
  }
20834
- function validateVisitorMethods(path14, val) {
20834
+ function validateVisitorMethods(path18, val) {
20835
20835
  const fns = [].concat(val);
20836
20836
  for (const fn of fns) {
20837
20837
  if (typeof fn !== "function") {
20838
- throw new TypeError(`Non-function found defined in ${path14} with type ${typeof fn}`);
20838
+ throw new TypeError(`Non-function found defined in ${path18} with type ${typeof fn}`);
20839
20839
  }
20840
20840
  }
20841
20841
  }
@@ -20878,8 +20878,8 @@ var require_visitors = __commonJS({
20878
20878
  fns = fns.map(function(fn) {
20879
20879
  let newFn = fn;
20880
20880
  if (state) {
20881
- newFn = function(path14) {
20882
- fn.call(state, path14, state);
20881
+ newFn = function(path18) {
20882
+ fn.call(state, path18, state);
20883
20883
  };
20884
20884
  }
20885
20885
  if (wrapper) {
@@ -20912,8 +20912,8 @@ var require_visitors = __commonJS({
20912
20912
  function wrapCheck(nodeType, fn) {
20913
20913
  const fnKey = `is${nodeType}`;
20914
20914
  const validator = virtualTypesValidators[fnKey];
20915
- const newFn = function(path14) {
20916
- if (validator.call(path14)) {
20915
+ const newFn = function(path18) {
20916
+ if (validator.call(path18)) {
20917
20917
  return fn.apply(this, arguments);
20918
20918
  }
20919
20919
  };
@@ -20938,24 +20938,24 @@ var require_visitors = __commonJS({
20938
20938
  }
20939
20939
  }
20940
20940
  var _environmentVisitor = {
20941
- FunctionParent(path14) {
20942
- if (path14.isArrowFunctionExpression()) return;
20943
- path14.skip();
20944
- if (path14.isMethod()) {
20945
- if (!path14.requeueComputedKeyAndDecorators) {
20946
- _context.requeueComputedKeyAndDecorators.call(path14);
20941
+ FunctionParent(path18) {
20942
+ if (path18.isArrowFunctionExpression()) return;
20943
+ path18.skip();
20944
+ if (path18.isMethod()) {
20945
+ if (!path18.requeueComputedKeyAndDecorators) {
20946
+ _context.requeueComputedKeyAndDecorators.call(path18);
20947
20947
  } else {
20948
- path14.requeueComputedKeyAndDecorators();
20948
+ path18.requeueComputedKeyAndDecorators();
20949
20949
  }
20950
20950
  }
20951
20951
  },
20952
- Property(path14) {
20953
- if (path14.isObjectProperty()) return;
20954
- path14.skip();
20955
- if (!path14.requeueComputedKeyAndDecorators) {
20956
- _context.requeueComputedKeyAndDecorators.call(path14);
20952
+ Property(path18) {
20953
+ if (path18.isObjectProperty()) return;
20954
+ path18.skip();
20955
+ if (!path18.requeueComputedKeyAndDecorators) {
20956
+ _context.requeueComputedKeyAndDecorators.call(path18);
20957
20957
  } else {
20958
- path14.requeueComputedKeyAndDecorators();
20958
+ path18.requeueComputedKeyAndDecorators();
20959
20959
  }
20960
20960
  }
20961
20961
  };
@@ -20989,18 +20989,18 @@ var require_renamer = __commonJS({
20989
20989
  node.name = state.newName;
20990
20990
  }
20991
20991
  },
20992
- Scope(path14, state) {
20993
- if (!path14.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
20994
- path14.skip();
20995
- if (path14.isMethod()) {
20996
- if (!path14.requeueComputedKeyAndDecorators) {
20997
- _context.requeueComputedKeyAndDecorators.call(path14);
20992
+ Scope(path18, state) {
20993
+ if (!path18.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
20994
+ path18.skip();
20995
+ if (path18.isMethod()) {
20996
+ if (!path18.requeueComputedKeyAndDecorators) {
20997
+ _context.requeueComputedKeyAndDecorators.call(path18);
20998
20998
  } else {
20999
- path14.requeueComputedKeyAndDecorators();
20999
+ path18.requeueComputedKeyAndDecorators();
21000
21000
  }
21001
21001
  }
21002
- if (path14.isSwitchStatement()) {
21003
- path14.context.maybeQueue(path14.get("discriminant"));
21002
+ if (path18.isSwitchStatement()) {
21003
+ path18.context.maybeQueue(path18.get("discriminant"));
21004
21004
  }
21005
21005
  }
21006
21006
  },
@@ -21017,9 +21017,9 @@ var require_renamer = __commonJS({
21017
21017
  if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
21018
21018
  }
21019
21019
  },
21020
- "AssignmentExpression|Declaration|VariableDeclarator"(path14, state) {
21021
- if (path14.isVariableDeclaration()) return;
21022
- const ids = path14.isAssignmentExpression() ? getAssignmentIdentifiers(path14.node) : path14.getOuterBindingIdentifiers();
21020
+ "AssignmentExpression|Declaration|VariableDeclarator"(path18, state) {
21021
+ if (path18.isVariableDeclaration()) return;
21022
+ const ids = path18.isAssignmentExpression() ? getAssignmentIdentifiers(path18.node) : path18.getOuterBindingIdentifiers();
21023
21023
  for (const name in ids) {
21024
21024
  if (name === state.oldName) ids[name].name = state.newName;
21025
21025
  }
@@ -21049,11 +21049,11 @@ var require_renamer = __commonJS({
21049
21049
  }
21050
21050
  maybeExportDeclar.splitExportDeclaration();
21051
21051
  }
21052
- maybeConvertFromClassFunctionDeclaration(path14) {
21053
- return path14;
21052
+ maybeConvertFromClassFunctionDeclaration(path18) {
21053
+ return path18;
21054
21054
  }
21055
- maybeConvertFromClassFunctionExpression(path14) {
21056
- return path14;
21055
+ maybeConvertFromClassFunctionExpression(path18) {
21056
+ return path18;
21057
21057
  }
21058
21058
  rename() {
21059
21059
  const {
@@ -21063,9 +21063,9 @@ var require_renamer = __commonJS({
21063
21063
  } = this;
21064
21064
  const {
21065
21065
  scope,
21066
- path: path14
21066
+ path: path18
21067
21067
  } = binding;
21068
- const parentDeclar = path14.find((path15) => path15.isDeclaration() || path15.isFunctionExpression() || path15.isClassExpression());
21068
+ const parentDeclar = path18.find((path19) => path19.isDeclaration() || path19.isFunctionExpression() || path19.isClassExpression());
21069
21069
  if (parentDeclar) {
21070
21070
  const bindingIds = parentDeclar.getOuterBindingIdentifiers();
21071
21071
  if (bindingIds[oldName] === binding.identifier) {
@@ -21091,8 +21091,8 @@ var require_renamer = __commonJS({
21091
21091
  this.binding.identifier.name = newName;
21092
21092
  }
21093
21093
  if (parentDeclar) {
21094
- this.maybeConvertFromClassFunctionDeclaration(path14);
21095
- this.maybeConvertFromClassFunctionExpression(path14);
21094
+ this.maybeConvertFromClassFunctionDeclaration(path18);
21095
+ this.maybeConvertFromClassFunctionExpression(path18);
21096
21096
  }
21097
21097
  }
21098
21098
  };
@@ -21115,17 +21115,17 @@ var require_traverseForScope = __commonJS({
21115
21115
  var {
21116
21116
  VISITOR_KEYS
21117
21117
  } = _t;
21118
- function traverseForScope(path14, visitors, state) {
21118
+ function traverseForScope(path18, visitors, state) {
21119
21119
  const exploded = (0, _visitors.explode)(visitors);
21120
21120
  if (exploded.enter || exploded.exit) {
21121
21121
  throw new Error("Should not be used with enter/exit visitors.");
21122
21122
  }
21123
- _traverse(path14.parentPath, path14.parent, path14.node, path14.container, path14.key, path14.listKey, path14.hub, path14);
21123
+ _traverse(path18.parentPath, path18.parent, path18.node, path18.container, path18.key, path18.listKey, path18.hub, path18);
21124
21124
  function _traverse(parentPath, parent, node, container, key, listKey, hub, inPath) {
21125
21125
  if (!node) {
21126
21126
  return;
21127
21127
  }
21128
- const path15 = inPath || _index.NodePath.get({
21128
+ const path19 = inPath || _index.NodePath.get({
21129
21129
  hub,
21130
21130
  parentPath,
21131
21131
  parent,
@@ -21133,14 +21133,14 @@ var require_traverseForScope = __commonJS({
21133
21133
  listKey,
21134
21134
  key
21135
21135
  });
21136
- _context._forceSetScope.call(path15);
21136
+ _context._forceSetScope.call(path19);
21137
21137
  const visitor = exploded[node.type];
21138
21138
  if (visitor != null && visitor.enter) {
21139
21139
  for (const visit of visitor.enter) {
21140
- visit.call(state, path15, state);
21140
+ visit.call(state, path19, state);
21141
21141
  }
21142
21142
  }
21143
- if (path15.shouldSkip) {
21143
+ if (path19.shouldSkip) {
21144
21144
  return;
21145
21145
  }
21146
21146
  const keys = VISITOR_KEYS[node.type];
@@ -21153,15 +21153,15 @@ var require_traverseForScope = __commonJS({
21153
21153
  if (Array.isArray(prop)) {
21154
21154
  for (let i = 0; i < prop.length; i++) {
21155
21155
  const value = prop[i];
21156
- _traverse(path15, node, value, prop, i, key2);
21156
+ _traverse(path19, node, value, prop, i, key2);
21157
21157
  }
21158
21158
  } else {
21159
- _traverse(path15, node, prop, node, key2, null);
21159
+ _traverse(path19, node, prop, node, key2, null);
21160
21160
  }
21161
21161
  }
21162
21162
  if (visitor != null && visitor.exit) {
21163
21163
  for (const visit of visitor.exit) {
21164
- visit.call(state, path15, state);
21164
+ visit.call(state, path19, state);
21165
21165
  }
21166
21166
  }
21167
21167
  }
@@ -21181,7 +21181,7 @@ var require_binding = __commonJS({
21181
21181
  constructor({
21182
21182
  identifier,
21183
21183
  scope,
21184
- path: path14,
21184
+ path: path18,
21185
21185
  kind
21186
21186
  }) {
21187
21187
  this.identifier = void 0;
@@ -21195,10 +21195,10 @@ var require_binding = __commonJS({
21195
21195
  this.references = 0;
21196
21196
  this.identifier = identifier;
21197
21197
  this.scope = scope;
21198
- this.path = path14;
21198
+ this.path = path18;
21199
21199
  this.kind = kind;
21200
- if ((kind === "var" || kind === "hoisted") && isInitInLoop(path14)) {
21201
- this.reassign(path14);
21200
+ if ((kind === "var" || kind === "hoisted") && isInitInLoop(path18)) {
21201
+ this.reassign(path18);
21202
21202
  }
21203
21203
  this.clearValue();
21204
21204
  }
@@ -21216,20 +21216,20 @@ var require_binding = __commonJS({
21216
21216
  this.hasValue = false;
21217
21217
  this.value = null;
21218
21218
  }
21219
- reassign(path14) {
21219
+ reassign(path18) {
21220
21220
  this.constant = false;
21221
- if (this.constantViolations.includes(path14)) {
21221
+ if (this.constantViolations.includes(path18)) {
21222
21222
  return;
21223
21223
  }
21224
- this.constantViolations.push(path14);
21224
+ this.constantViolations.push(path18);
21225
21225
  }
21226
- reference(path14) {
21227
- if (this.referencePaths.includes(path14)) {
21226
+ reference(path18) {
21227
+ if (this.referencePaths.includes(path18)) {
21228
21228
  return;
21229
21229
  }
21230
21230
  this.referenced = true;
21231
21231
  this.references++;
21232
- this.referencePaths.push(path14);
21232
+ this.referencePaths.push(path18);
21233
21233
  }
21234
21234
  dereference() {
21235
21235
  this.references--;
@@ -21237,12 +21237,12 @@ var require_binding = __commonJS({
21237
21237
  }
21238
21238
  };
21239
21239
  exports.default = Binding;
21240
- function isInitInLoop(path14) {
21241
- const isFunctionDeclarationOrHasInit = !path14.isVariableDeclarator() || path14.node.init;
21240
+ function isInitInLoop(path18) {
21241
+ const isFunctionDeclarationOrHasInit = !path18.isVariableDeclarator() || path18.node.init;
21242
21242
  for (let {
21243
21243
  parentPath,
21244
21244
  key
21245
- } = path14; parentPath; {
21245
+ } = path18; parentPath; {
21246
21246
  parentPath,
21247
21247
  key
21248
21248
  } = parentPath) {
@@ -21281,11 +21281,11 @@ var require_cache = __commonJS({
21281
21281
  function clearScope() {
21282
21282
  exports.scope = scope = /* @__PURE__ */ new WeakMap();
21283
21283
  }
21284
- function getCachedPaths(path14) {
21284
+ function getCachedPaths(path18) {
21285
21285
  const {
21286
21286
  parent,
21287
21287
  parentPath
21288
- } = path14;
21288
+ } = path18;
21289
21289
  return pathsCache.get(parent);
21290
21290
  }
21291
21291
  function getOrCreateCachedPaths(node, parentPath) {
@@ -21561,128 +21561,128 @@ var require_scope = __commonJS({
21561
21561
  scope.bindings = /* @__PURE__ */ Object.create(null);
21562
21562
  scope.globals = /* @__PURE__ */ Object.create(null);
21563
21563
  }
21564
- function isAnonymousFunctionExpression(path14) {
21565
- return path14.isFunctionExpression() && !path14.node.id || path14.isArrowFunctionExpression();
21564
+ function isAnonymousFunctionExpression(path18) {
21565
+ return path18.isFunctionExpression() && !path18.node.id || path18.isArrowFunctionExpression();
21566
21566
  }
21567
21567
  var NOT_LOCAL_BINDING = /* @__PURE__ */ Symbol.for("should not be considered a local binding");
21568
21568
  var collectorVisitor = {
21569
- ForStatement(path14) {
21570
- const declar = path14.get("init");
21569
+ ForStatement(path18) {
21570
+ const declar = path18.get("init");
21571
21571
  if (declar.isVar()) {
21572
21572
  const {
21573
21573
  scope
21574
- } = path14;
21574
+ } = path18;
21575
21575
  const parentScope = scope.getFunctionParent() || scope.getProgramParent();
21576
21576
  parentScope.registerBinding("var", declar);
21577
21577
  }
21578
21578
  },
21579
- Declaration(path14) {
21580
- if (path14.isBlockScoped()) return;
21581
- if (path14.isImportDeclaration()) return;
21582
- if (path14.isExportDeclaration()) return;
21583
- const parent = path14.scope.getFunctionParent() || path14.scope.getProgramParent();
21584
- parent.registerDeclaration(path14);
21579
+ Declaration(path18) {
21580
+ if (path18.isBlockScoped()) return;
21581
+ if (path18.isImportDeclaration()) return;
21582
+ if (path18.isExportDeclaration()) return;
21583
+ const parent = path18.scope.getFunctionParent() || path18.scope.getProgramParent();
21584
+ parent.registerDeclaration(path18);
21585
21585
  },
21586
- ImportDeclaration(path14) {
21587
- const parent = path14.scope.getBlockParent();
21588
- parent.registerDeclaration(path14);
21586
+ ImportDeclaration(path18) {
21587
+ const parent = path18.scope.getBlockParent();
21588
+ parent.registerDeclaration(path18);
21589
21589
  },
21590
- TSImportEqualsDeclaration(path14) {
21591
- const parent = path14.scope.getBlockParent();
21592
- parent.registerDeclaration(path14);
21590
+ TSImportEqualsDeclaration(path18) {
21591
+ const parent = path18.scope.getBlockParent();
21592
+ parent.registerDeclaration(path18);
21593
21593
  },
21594
- ReferencedIdentifier(path14, state) {
21595
- if (t2.isTSQualifiedName(path14.parent) && path14.parent.right === path14.node) {
21594
+ ReferencedIdentifier(path18, state) {
21595
+ if (t2.isTSQualifiedName(path18.parent) && path18.parent.right === path18.node) {
21596
21596
  return;
21597
21597
  }
21598
- if (path14.parentPath.isTSImportEqualsDeclaration()) return;
21599
- state.references.push(path14);
21598
+ if (path18.parentPath.isTSImportEqualsDeclaration()) return;
21599
+ state.references.push(path18);
21600
21600
  },
21601
- ForXStatement(path14, state) {
21602
- const left = path14.get("left");
21601
+ ForXStatement(path18, state) {
21602
+ const left = path18.get("left");
21603
21603
  if (left.isPattern() || left.isIdentifier()) {
21604
- state.constantViolations.push(path14);
21604
+ state.constantViolations.push(path18);
21605
21605
  } else if (left.isVar()) {
21606
21606
  const {
21607
21607
  scope
21608
- } = path14;
21608
+ } = path18;
21609
21609
  const parentScope = scope.getFunctionParent() || scope.getProgramParent();
21610
21610
  parentScope.registerBinding("var", left);
21611
21611
  }
21612
21612
  },
21613
21613
  ExportDeclaration: {
21614
- exit(path14) {
21614
+ exit(path18) {
21615
21615
  const {
21616
21616
  node,
21617
21617
  scope
21618
- } = path14;
21618
+ } = path18;
21619
21619
  if (isExportAllDeclaration(node)) return;
21620
21620
  const declar = node.declaration;
21621
21621
  if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {
21622
21622
  const id = declar.id;
21623
21623
  if (!id) return;
21624
21624
  const binding = scope.getBinding(id.name);
21625
- binding == null || binding.reference(path14);
21625
+ binding == null || binding.reference(path18);
21626
21626
  } else if (isVariableDeclaration(declar)) {
21627
21627
  for (const decl of declar.declarations) {
21628
21628
  for (const name of Object.keys(getBindingIdentifiers(decl))) {
21629
21629
  const binding = scope.getBinding(name);
21630
- binding == null || binding.reference(path14);
21630
+ binding == null || binding.reference(path18);
21631
21631
  }
21632
21632
  }
21633
21633
  }
21634
21634
  }
21635
21635
  },
21636
- LabeledStatement(path14) {
21637
- path14.scope.getBlockParent().registerDeclaration(path14);
21636
+ LabeledStatement(path18) {
21637
+ path18.scope.getBlockParent().registerDeclaration(path18);
21638
21638
  },
21639
- AssignmentExpression(path14, state) {
21640
- state.assignments.push(path14);
21639
+ AssignmentExpression(path18, state) {
21640
+ state.assignments.push(path18);
21641
21641
  },
21642
- UpdateExpression(path14, state) {
21643
- state.constantViolations.push(path14);
21642
+ UpdateExpression(path18, state) {
21643
+ state.constantViolations.push(path18);
21644
21644
  },
21645
- UnaryExpression(path14, state) {
21646
- if (path14.node.operator === "delete") {
21647
- state.constantViolations.push(path14);
21645
+ UnaryExpression(path18, state) {
21646
+ if (path18.node.operator === "delete") {
21647
+ state.constantViolations.push(path18);
21648
21648
  }
21649
21649
  },
21650
- BlockScoped(path14) {
21651
- let scope = path14.scope;
21652
- if (scope.path === path14) scope = scope.parent;
21650
+ BlockScoped(path18) {
21651
+ let scope = path18.scope;
21652
+ if (scope.path === path18) scope = scope.parent;
21653
21653
  const parent = scope.getBlockParent();
21654
- parent.registerDeclaration(path14);
21655
- if (path14.isClassDeclaration() && path14.node.id) {
21656
- const id = path14.node.id;
21654
+ parent.registerDeclaration(path18);
21655
+ if (path18.isClassDeclaration() && path18.node.id) {
21656
+ const id = path18.node.id;
21657
21657
  const name = id.name;
21658
- path14.scope.bindings[name] = path14.scope.parent.getBinding(name);
21658
+ path18.scope.bindings[name] = path18.scope.parent.getBinding(name);
21659
21659
  }
21660
21660
  },
21661
- CatchClause(path14) {
21662
- path14.scope.registerBinding("let", path14);
21661
+ CatchClause(path18) {
21662
+ path18.scope.registerBinding("let", path18);
21663
21663
  },
21664
- Function(path14) {
21665
- const params = path14.get("params");
21664
+ Function(path18) {
21665
+ const params = path18.get("params");
21666
21666
  for (const param of params) {
21667
- path14.scope.registerBinding("param", param);
21667
+ path18.scope.registerBinding("param", param);
21668
21668
  }
21669
- if (path14.isFunctionExpression() && path14.node.id && !path14.node.id[NOT_LOCAL_BINDING]) {
21670
- path14.scope.registerBinding("local", path14.get("id"), path14);
21669
+ if (path18.isFunctionExpression() && path18.node.id && !path18.node.id[NOT_LOCAL_BINDING]) {
21670
+ path18.scope.registerBinding("local", path18.get("id"), path18);
21671
21671
  }
21672
21672
  },
21673
- ClassExpression(path14) {
21674
- if (path14.node.id && !path14.node.id[NOT_LOCAL_BINDING]) {
21675
- path14.scope.registerBinding("local", path14.get("id"), path14);
21673
+ ClassExpression(path18) {
21674
+ if (path18.node.id && !path18.node.id[NOT_LOCAL_BINDING]) {
21675
+ path18.scope.registerBinding("local", path18.get("id"), path18);
21676
21676
  }
21677
21677
  },
21678
- TSTypeAnnotation(path14) {
21679
- path14.skip();
21678
+ TSTypeAnnotation(path18) {
21679
+ path18.skip();
21680
21680
  }
21681
21681
  };
21682
21682
  var scopeVisitor;
21683
21683
  var uid = 0;
21684
21684
  var Scope = class _Scope {
21685
- constructor(path14) {
21685
+ constructor(path18) {
21686
21686
  this.uid = void 0;
21687
21687
  this.path = void 0;
21688
21688
  this.block = void 0;
@@ -21696,15 +21696,15 @@ var require_scope = __commonJS({
21696
21696
  this.crawling = void 0;
21697
21697
  const {
21698
21698
  node
21699
- } = path14;
21699
+ } = path18;
21700
21700
  const cached = _cache.scope.get(node);
21701
- if ((cached == null ? void 0 : cached.path) === path14) {
21701
+ if ((cached == null ? void 0 : cached.path) === path18) {
21702
21702
  return cached;
21703
21703
  }
21704
21704
  _cache.scope.set(node, this);
21705
21705
  this.uid = uid++;
21706
21706
  this.block = node;
21707
- this.path = path14;
21707
+ this.path = path18;
21708
21708
  this.labels = /* @__PURE__ */ new Map();
21709
21709
  this.inited = false;
21710
21710
  Object.defineProperties(this, {
@@ -21724,14 +21724,14 @@ var require_scope = __commonJS({
21724
21724
  }
21725
21725
  get parent() {
21726
21726
  var _parent;
21727
- let parent, path14 = this.path;
21727
+ let parent, path18 = this.path;
21728
21728
  do {
21729
21729
  var _path;
21730
- const shouldSkip = path14.key === "key" || path14.listKey === "decorators";
21731
- path14 = path14.parentPath;
21732
- if (shouldSkip && path14.isMethod()) path14 = path14.parentPath;
21733
- if ((_path = path14) != null && _path.isScope()) parent = path14;
21734
- } while (path14 && !parent);
21730
+ const shouldSkip = path18.key === "key" || path18.listKey === "decorators";
21731
+ path18 = path18.parentPath;
21732
+ if (shouldSkip && path18.isMethod()) path18 = path18.parentPath;
21733
+ if ((_path = path18) != null && _path.isScope()) parent = path18;
21734
+ } while (path18 && !parent);
21735
21735
  return (_parent = parent) == null ? void 0 : _parent.scope;
21736
21736
  }
21737
21737
  get references() {
@@ -21844,62 +21844,62 @@ var require_scope = __commonJS({
21844
21844
  getLabel(name) {
21845
21845
  return this.labels.get(name);
21846
21846
  }
21847
- registerLabel(path14) {
21848
- this.labels.set(path14.node.label.name, path14);
21847
+ registerLabel(path18) {
21848
+ this.labels.set(path18.node.label.name, path18);
21849
21849
  }
21850
- registerDeclaration(path14) {
21851
- if (path14.isLabeledStatement()) {
21852
- this.registerLabel(path14);
21853
- } else if (path14.isFunctionDeclaration()) {
21854
- this.registerBinding("hoisted", path14.get("id"), path14);
21855
- } else if (path14.isVariableDeclaration()) {
21856
- const declarations = path14.get("declarations");
21850
+ registerDeclaration(path18) {
21851
+ if (path18.isLabeledStatement()) {
21852
+ this.registerLabel(path18);
21853
+ } else if (path18.isFunctionDeclaration()) {
21854
+ this.registerBinding("hoisted", path18.get("id"), path18);
21855
+ } else if (path18.isVariableDeclaration()) {
21856
+ const declarations = path18.get("declarations");
21857
21857
  const {
21858
21858
  kind
21859
- } = path14.node;
21859
+ } = path18.node;
21860
21860
  for (const declar of declarations) {
21861
21861
  this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar);
21862
21862
  }
21863
- } else if (path14.isClassDeclaration()) {
21864
- if (path14.node.declare) return;
21865
- this.registerBinding("let", path14);
21866
- } else if (path14.isImportDeclaration()) {
21867
- const isTypeDeclaration = path14.node.importKind === "type" || path14.node.importKind === "typeof";
21868
- const specifiers = path14.get("specifiers");
21863
+ } else if (path18.isClassDeclaration()) {
21864
+ if (path18.node.declare) return;
21865
+ this.registerBinding("let", path18);
21866
+ } else if (path18.isImportDeclaration()) {
21867
+ const isTypeDeclaration = path18.node.importKind === "type" || path18.node.importKind === "typeof";
21868
+ const specifiers = path18.get("specifiers");
21869
21869
  for (const specifier of specifiers) {
21870
21870
  const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
21871
21871
  this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
21872
21872
  }
21873
- } else if (path14.isExportDeclaration()) {
21874
- const declar = path14.get("declaration");
21873
+ } else if (path18.isExportDeclaration()) {
21874
+ const declar = path18.get("declaration");
21875
21875
  if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) {
21876
21876
  this.registerDeclaration(declar);
21877
21877
  }
21878
21878
  } else {
21879
- this.registerBinding("unknown", path14);
21879
+ this.registerBinding("unknown", path18);
21880
21880
  }
21881
21881
  }
21882
21882
  buildUndefinedNode() {
21883
21883
  return buildUndefinedNode();
21884
21884
  }
21885
- registerConstantViolation(path14) {
21886
- const ids = path14.getAssignmentIdentifiers();
21885
+ registerConstantViolation(path18) {
21886
+ const ids = path18.getAssignmentIdentifiers();
21887
21887
  for (const name of Object.keys(ids)) {
21888
21888
  var _this$getBinding;
21889
- (_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(path14);
21889
+ (_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(path18);
21890
21890
  }
21891
21891
  }
21892
- registerBinding(kind, path14, bindingPath = path14) {
21892
+ registerBinding(kind, path18, bindingPath = path18) {
21893
21893
  if (!kind) throw new ReferenceError("no `kind`");
21894
- if (path14.isVariableDeclaration()) {
21895
- const declarators = path14.get("declarations");
21894
+ if (path18.isVariableDeclaration()) {
21895
+ const declarators = path18.get("declarations");
21896
21896
  for (const declar of declarators) {
21897
21897
  this.registerBinding(kind, declar);
21898
21898
  }
21899
21899
  return;
21900
21900
  }
21901
21901
  const parent = this.getProgramParent();
21902
- const ids = path14.getOuterBindingIdentifiers(true);
21902
+ const ids = path18.getOuterBindingIdentifiers(true);
21903
21903
  for (const name of Object.keys(ids)) {
21904
21904
  parent.references[name] = true;
21905
21905
  for (const id of ids[name]) {
@@ -22041,7 +22041,7 @@ var require_scope = __commonJS({
22041
22041
  }
22042
22042
  }
22043
22043
  crawl() {
22044
- const path14 = this.path;
22044
+ const path18 = this.path;
22045
22045
  resetScope(this);
22046
22046
  this.data = /* @__PURE__ */ Object.create(null);
22047
22047
  let scope = this;
@@ -22059,27 +22059,27 @@ var require_scope = __commonJS({
22059
22059
  };
22060
22060
  this.crawling = true;
22061
22061
  scopeVisitor || (scopeVisitor = _index.default.visitors.merge([{
22062
- Scope(path15) {
22063
- resetScope(path15.scope);
22062
+ Scope(path19) {
22063
+ resetScope(path19.scope);
22064
22064
  }
22065
22065
  }, collectorVisitor]));
22066
- if (path14.type !== "Program") {
22067
- const typeVisitors = scopeVisitor[path14.type];
22066
+ if (path18.type !== "Program") {
22067
+ const typeVisitors = scopeVisitor[path18.type];
22068
22068
  if (typeVisitors) {
22069
22069
  for (const visit of typeVisitors.enter) {
22070
- visit.call(state, path14, state);
22070
+ visit.call(state, path18, state);
22071
22071
  }
22072
22072
  }
22073
22073
  }
22074
- path14.traverse(scopeVisitor, state);
22074
+ path18.traverse(scopeVisitor, state);
22075
22075
  this.crawling = false;
22076
- for (const path15 of state.assignments) {
22077
- const ids = path15.getAssignmentIdentifiers();
22076
+ for (const path19 of state.assignments) {
22077
+ const ids = path19.getAssignmentIdentifiers();
22078
22078
  for (const name of Object.keys(ids)) {
22079
- if (path15.scope.getBinding(name)) continue;
22079
+ if (path19.scope.getBinding(name)) continue;
22080
22080
  programParent.addGlobal(ids[name]);
22081
22081
  }
22082
- path15.scope.registerConstantViolation(path15);
22082
+ path19.scope.registerConstantViolation(path19);
22083
22083
  }
22084
22084
  for (const ref of state.references) {
22085
22085
  const binding = ref.scope.getBinding(ref.node.name);
@@ -22089,19 +22089,19 @@ var require_scope = __commonJS({
22089
22089
  programParent.addGlobal(ref.node);
22090
22090
  }
22091
22091
  }
22092
- for (const path15 of state.constantViolations) {
22093
- path15.scope.registerConstantViolation(path15);
22092
+ for (const path19 of state.constantViolations) {
22093
+ path19.scope.registerConstantViolation(path19);
22094
22094
  }
22095
22095
  }
22096
22096
  push(opts) {
22097
- let path14 = this.path;
22098
- if (path14.isPattern()) {
22099
- path14 = this.getPatternParent().path;
22100
- } else if (!path14.isBlockStatement() && !path14.isProgram()) {
22101
- path14 = this.getBlockParent().path;
22097
+ let path18 = this.path;
22098
+ if (path18.isPattern()) {
22099
+ path18 = this.getPatternParent().path;
22100
+ } else if (!path18.isBlockStatement() && !path18.isProgram()) {
22101
+ path18 = this.getBlockParent().path;
22102
22102
  }
22103
- if (path14.isSwitchStatement()) {
22104
- path14 = (this.getFunctionParent() || this.getProgramParent()).path;
22103
+ if (path18.isSwitchStatement()) {
22104
+ path18 = (this.getFunctionParent() || this.getProgramParent()).path;
22105
22105
  }
22106
22106
  const {
22107
22107
  init,
@@ -22109,29 +22109,29 @@ var require_scope = __commonJS({
22109
22109
  kind = "var",
22110
22110
  id
22111
22111
  } = opts;
22112
- if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path14) && isCallExpression(path14.parent, {
22113
- callee: path14.node
22114
- }) && path14.parent.arguments.length <= path14.node.params.length && isIdentifier(id)) {
22115
- path14.pushContainer("params", id);
22116
- path14.scope.registerBinding("param", path14.get("params")[path14.node.params.length - 1]);
22112
+ if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path18) && isCallExpression(path18.parent, {
22113
+ callee: path18.node
22114
+ }) && path18.parent.arguments.length <= path18.node.params.length && isIdentifier(id)) {
22115
+ path18.pushContainer("params", id);
22116
+ path18.scope.registerBinding("param", path18.get("params")[path18.node.params.length - 1]);
22117
22117
  return;
22118
22118
  }
22119
- if (path14.isLoop() || path14.isCatchClause() || path14.isFunction()) {
22120
- path14.ensureBlock();
22121
- path14 = path14.get("body");
22119
+ if (path18.isLoop() || path18.isCatchClause() || path18.isFunction()) {
22120
+ path18.ensureBlock();
22121
+ path18 = path18.get("body");
22122
22122
  }
22123
22123
  const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
22124
22124
  const dataKey = `declaration:${kind}:${blockHoist}`;
22125
- let declarPath = !unique && path14.getData(dataKey);
22125
+ let declarPath = !unique && path18.getData(dataKey);
22126
22126
  if (!declarPath) {
22127
22127
  const declar = variableDeclaration(kind, []);
22128
22128
  declar._blockHoist = blockHoist;
22129
- [declarPath] = path14.unshiftContainer("body", [declar]);
22130
- if (!unique) path14.setData(dataKey, declarPath);
22129
+ [declarPath] = path18.unshiftContainer("body", [declar]);
22130
+ if (!unique) path18.setData(dataKey, declarPath);
22131
22131
  }
22132
22132
  const declarator = variableDeclarator(id, init);
22133
22133
  const len = declarPath.node.declarations.push(declarator);
22134
- path14.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
22134
+ path18.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
22135
22135
  }
22136
22136
  getProgramParent() {
22137
22137
  let scope = this;
@@ -22276,15 +22276,15 @@ var require_scope = __commonJS({
22276
22276
  const binding = this.bindings[name];
22277
22277
  if (!binding) continue;
22278
22278
  const {
22279
- path: path14
22279
+ path: path18
22280
22280
  } = binding;
22281
- if (!path14.isVariableDeclarator()) continue;
22281
+ if (!path18.isVariableDeclarator()) continue;
22282
22282
  const {
22283
22283
  parent,
22284
22284
  parentPath
22285
- } = path14;
22285
+ } = path18;
22286
22286
  if (parent.kind !== "var" || seen.has(parent)) continue;
22287
- seen.add(path14.parent);
22287
+ seen.add(path18.parent);
22288
22288
  let firstId;
22289
22289
  const init = [];
22290
22290
  for (const decl of parent.declarations) {
@@ -22933,16 +22933,16 @@ var require_resolve_uri_umd = __commonJS({
22933
22933
  }
22934
22934
  function parseFileUrl(input) {
22935
22935
  const match = fileRegex.exec(input);
22936
- const path14 = match[2];
22937
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path14) ? path14 : "/" + path14, match[3] || "", match[4] || "");
22936
+ const path18 = match[2];
22937
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path18) ? path18 : "/" + path18, match[3] || "", match[4] || "");
22938
22938
  }
22939
- function makeUrl(scheme, user, host, port, path14, query, hash) {
22939
+ function makeUrl(scheme, user, host, port, path18, query, hash) {
22940
22940
  return {
22941
22941
  scheme,
22942
22942
  user,
22943
22943
  host,
22944
22944
  port,
22945
- path: path14,
22945
+ path: path18,
22946
22946
  query,
22947
22947
  hash,
22948
22948
  type: 7
@@ -22972,11 +22972,11 @@ var require_resolve_uri_umd = __commonJS({
22972
22972
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
22973
22973
  return url;
22974
22974
  }
22975
- function stripPathFilename(path14) {
22976
- if (path14.endsWith("/.."))
22977
- return path14;
22978
- const index = path14.lastIndexOf("/");
22979
- return path14.slice(0, index + 1);
22975
+ function stripPathFilename(path18) {
22976
+ if (path18.endsWith("/.."))
22977
+ return path18;
22978
+ const index = path18.lastIndexOf("/");
22979
+ return path18.slice(0, index + 1);
22980
22980
  }
22981
22981
  function mergePaths(url, base) {
22982
22982
  normalizePath(base, base.type);
@@ -23014,14 +23014,14 @@ var require_resolve_uri_umd = __commonJS({
23014
23014
  pieces[pointer++] = piece;
23015
23015
  positive++;
23016
23016
  }
23017
- let path14 = "";
23017
+ let path18 = "";
23018
23018
  for (let i = 1; i < pointer; i++) {
23019
- path14 += "/" + pieces[i];
23019
+ path18 += "/" + pieces[i];
23020
23020
  }
23021
- if (!path14 || addTrailingSlash && !path14.endsWith("/..")) {
23022
- path14 += "/";
23021
+ if (!path18 || addTrailingSlash && !path18.endsWith("/..")) {
23022
+ path18 += "/";
23023
23023
  }
23024
- url.path = path14;
23024
+ url.path = path18;
23025
23025
  }
23026
23026
  function resolve(input, base) {
23027
23027
  if (!input && !base)
@@ -23062,13 +23062,13 @@ var require_resolve_uri_umd = __commonJS({
23062
23062
  case 3:
23063
23063
  return queryHash;
23064
23064
  case 4: {
23065
- const path14 = url.path.slice(1);
23066
- if (!path14)
23065
+ const path18 = url.path.slice(1);
23066
+ if (!path18)
23067
23067
  return queryHash || ".";
23068
- if (isRelative(base || input) && !isRelative(path14)) {
23069
- return "./" + path14 + queryHash;
23068
+ if (isRelative(base || input) && !isRelative(path18)) {
23069
+ return "./" + path18 + queryHash;
23070
23070
  }
23071
- return path14 + queryHash;
23071
+ return path18 + queryHash;
23072
23072
  }
23073
23073
  case 5:
23074
23074
  return url.path + queryHash;
@@ -23168,10 +23168,10 @@ var require_trace_mapping_umd = __commonJS({
23168
23168
  module2.exports = __toCommonJS(trace_mapping_exports);
23169
23169
  var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
23170
23170
  var import_resolve_uri = __toESM2(require_resolve_uri());
23171
- function stripFilename(path14) {
23172
- if (!path14) return "";
23173
- const index = path14.lastIndexOf("/");
23174
- return path14.slice(0, index + 1);
23171
+ function stripFilename(path18) {
23172
+ if (!path18) return "";
23173
+ const index = path18.lastIndexOf("/");
23174
+ return path18.slice(0, index + 1);
23175
23175
  }
23176
23176
  function resolver(mapUrl, sourceRoot) {
23177
23177
  const from = stripFilename(mapUrl);
@@ -29503,56 +29503,56 @@ var require_ancestry = __commonJS({
29503
29503
  VISITOR_KEYS
29504
29504
  } = _t;
29505
29505
  function findParent(callback) {
29506
- let path14 = this;
29507
- while (path14 = path14.parentPath) {
29508
- if (callback(path14)) return path14;
29506
+ let path18 = this;
29507
+ while (path18 = path18.parentPath) {
29508
+ if (callback(path18)) return path18;
29509
29509
  }
29510
29510
  return null;
29511
29511
  }
29512
29512
  function find(callback) {
29513
- let path14 = this;
29513
+ let path18 = this;
29514
29514
  do {
29515
- if (callback(path14)) return path14;
29516
- } while (path14 = path14.parentPath);
29515
+ if (callback(path18)) return path18;
29516
+ } while (path18 = path18.parentPath);
29517
29517
  return null;
29518
29518
  }
29519
29519
  function getFunctionParent() {
29520
29520
  return this.findParent((p) => p.isFunction());
29521
29521
  }
29522
29522
  function getStatementParent() {
29523
- let path14 = this;
29523
+ let path18 = this;
29524
29524
  do {
29525
- if (!path14.parentPath || Array.isArray(path14.container) && path14.isStatement()) {
29525
+ if (!path18.parentPath || Array.isArray(path18.container) && path18.isStatement()) {
29526
29526
  break;
29527
29527
  } else {
29528
- path14 = path14.parentPath;
29528
+ path18 = path18.parentPath;
29529
29529
  }
29530
- } while (path14);
29531
- if (path14 && (path14.isProgram() || path14.isFile())) {
29530
+ } while (path18);
29531
+ if (path18 && (path18.isProgram() || path18.isFile())) {
29532
29532
  throw new Error("File/Program node, we can't possibly find a statement parent to this");
29533
29533
  }
29534
- return path14;
29534
+ return path18;
29535
29535
  }
29536
29536
  function getEarliestCommonAncestorFrom(paths) {
29537
29537
  return this.getDeepestCommonAncestorFrom(paths, function(deepest, i, ancestries) {
29538
29538
  let earliest;
29539
29539
  const keys = VISITOR_KEYS[deepest.type];
29540
29540
  for (const ancestry of ancestries) {
29541
- const path14 = ancestry[i + 1];
29541
+ const path18 = ancestry[i + 1];
29542
29542
  if (!earliest) {
29543
- earliest = path14;
29543
+ earliest = path18;
29544
29544
  continue;
29545
29545
  }
29546
- if (path14.listKey && earliest.listKey === path14.listKey) {
29547
- if (path14.key < earliest.key) {
29548
- earliest = path14;
29546
+ if (path18.listKey && earliest.listKey === path18.listKey) {
29547
+ if (path18.key < earliest.key) {
29548
+ earliest = path18;
29549
29549
  continue;
29550
29550
  }
29551
29551
  }
29552
29552
  const earliestKeyIndex = keys.indexOf(earliest.parentKey);
29553
- const currentKeyIndex = keys.indexOf(path14.parentKey);
29553
+ const currentKeyIndex = keys.indexOf(path18.parentKey);
29554
29554
  if (earliestKeyIndex > currentKeyIndex) {
29555
- earliest = path14;
29555
+ earliest = path18;
29556
29556
  }
29557
29557
  }
29558
29558
  return earliest;
@@ -29567,11 +29567,11 @@ var require_ancestry = __commonJS({
29567
29567
  }
29568
29568
  let minDepth = Infinity;
29569
29569
  let lastCommonIndex, lastCommon;
29570
- const ancestries = paths.map((path14) => {
29570
+ const ancestries = paths.map((path18) => {
29571
29571
  const ancestry = [];
29572
29572
  do {
29573
- ancestry.unshift(path14);
29574
- } while ((path14 = path14.parentPath) && path14 !== this);
29573
+ ancestry.unshift(path18);
29574
+ } while ((path18 = path18.parentPath) && path18 !== this);
29575
29575
  if (ancestry.length < minDepth) {
29576
29576
  minDepth = ancestry.length;
29577
29577
  }
@@ -29599,11 +29599,11 @@ var require_ancestry = __commonJS({
29599
29599
  }
29600
29600
  }
29601
29601
  function getAncestry() {
29602
- let path14 = this;
29602
+ let path18 = this;
29603
29603
  const paths = [];
29604
29604
  do {
29605
- paths.push(path14);
29606
- } while (path14 = path14.parentPath);
29605
+ paths.push(path18);
29606
+ } while (path18 = path18.parentPath);
29607
29607
  return paths;
29608
29608
  }
29609
29609
  function isAncestor(maybeDescendant) {
@@ -29613,10 +29613,10 @@ var require_ancestry = __commonJS({
29613
29613
  return !!this.findParent((parent) => parent === maybeAncestor);
29614
29614
  }
29615
29615
  function inType(...candidateTypes) {
29616
- let path14 = this;
29617
- while (path14) {
29618
- if (candidateTypes.includes(path14.node.type)) return true;
29619
- path14 = path14.parentPath;
29616
+ let path18 = this;
29617
+ while (path18) {
29618
+ if (candidateTypes.includes(path18.node.type)) return true;
29619
+ path18 = path18.parentPath;
29620
29620
  }
29621
29621
  return false;
29622
29622
  }
@@ -29687,14 +29687,14 @@ var require_inferer_reference = __commonJS({
29687
29687
  } else if (node.name === "arguments") {
29688
29688
  }
29689
29689
  }
29690
- function getTypeAnnotationBindingConstantViolations(binding, path14, name) {
29690
+ function getTypeAnnotationBindingConstantViolations(binding, path18, name) {
29691
29691
  const types = [];
29692
29692
  const functionConstantViolations = [];
29693
- let constantViolations = getConstantViolationsBefore(binding, path14, functionConstantViolations);
29694
- const testType = getConditionalAnnotation(binding, path14, name);
29693
+ let constantViolations = getConstantViolationsBefore(binding, path18, functionConstantViolations);
29694
+ const testType = getConditionalAnnotation(binding, path18, name);
29695
29695
  if (testType) {
29696
29696
  const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
29697
- constantViolations = constantViolations.filter((path15) => !testConstantViolations.includes(path15));
29697
+ constantViolations = constantViolations.filter((path19) => !testConstantViolations.includes(path19));
29698
29698
  types.push(testType.typeAnnotation);
29699
29699
  }
29700
29700
  if (constantViolations.length) {
@@ -29708,20 +29708,20 @@ var require_inferer_reference = __commonJS({
29708
29708
  }
29709
29709
  return (0, _util.createUnionType)(types);
29710
29710
  }
29711
- function getConstantViolationsBefore(binding, path14, functions) {
29711
+ function getConstantViolationsBefore(binding, path18, functions) {
29712
29712
  const violations = binding.constantViolations.slice();
29713
29713
  violations.unshift(binding.path);
29714
29714
  return violations.filter((violation) => {
29715
29715
  violation = violation.resolve();
29716
- const status = violation._guessExecutionStatusRelativeTo(path14);
29716
+ const status = violation._guessExecutionStatusRelativeTo(path18);
29717
29717
  if (functions && status === "unknown") functions.push(violation);
29718
29718
  return status === "before";
29719
29719
  });
29720
29720
  }
29721
- function inferAnnotationFromBinaryExpression(name, path14) {
29722
- const operator = path14.node.operator;
29723
- const right = path14.get("right").resolve();
29724
- const left = path14.get("left").resolve();
29721
+ function inferAnnotationFromBinaryExpression(name, path18) {
29722
+ const operator = path18.node.operator;
29723
+ const right = path18.get("right").resolve();
29724
+ const left = path18.get("left").resolve();
29725
29725
  let target;
29726
29726
  if (left.isIdentifier({
29727
29727
  name
@@ -29765,11 +29765,11 @@ var require_inferer_reference = __commonJS({
29765
29765
  if (typeof typeValue !== "string") return;
29766
29766
  return createTypeAnnotationBasedOnTypeof(typeValue);
29767
29767
  }
29768
- function getParentConditionalPath(binding, path14, name) {
29768
+ function getParentConditionalPath(binding, path18, name) {
29769
29769
  let parentPath;
29770
- while (parentPath = path14.parentPath) {
29770
+ while (parentPath = path18.parentPath) {
29771
29771
  if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
29772
- if (path14.key === "test") {
29772
+ if (path18.key === "test") {
29773
29773
  return;
29774
29774
  }
29775
29775
  return parentPath;
@@ -29777,24 +29777,24 @@ var require_inferer_reference = __commonJS({
29777
29777
  if (parentPath.isFunction()) {
29778
29778
  if (name == null || parentPath.parentPath.scope.getBinding(name) !== binding) return;
29779
29779
  }
29780
- path14 = parentPath;
29780
+ path18 = parentPath;
29781
29781
  }
29782
29782
  }
29783
- function getConditionalAnnotation(binding, path14, name) {
29784
- const ifStatement = getParentConditionalPath(binding, path14, name);
29783
+ function getConditionalAnnotation(binding, path18, name) {
29784
+ const ifStatement = getParentConditionalPath(binding, path18, name);
29785
29785
  if (!ifStatement) return;
29786
29786
  const test = ifStatement.get("test");
29787
29787
  const paths = [test];
29788
29788
  const types = [];
29789
29789
  for (let i = 0; i < paths.length; i++) {
29790
- const path15 = paths[i];
29791
- if (path15.isLogicalExpression()) {
29792
- if (path15.node.operator === "&&") {
29793
- paths.push(path15.get("left"));
29794
- paths.push(path15.get("right"));
29795
- }
29796
- } else if (path15.isBinaryExpression()) {
29797
- const type = inferAnnotationFromBinaryExpression(name, path15);
29790
+ const path19 = paths[i];
29791
+ if (path19.isLogicalExpression()) {
29792
+ if (path19.node.operator === "&&") {
29793
+ paths.push(path19.get("left"));
29794
+ paths.push(path19.get("right"));
29795
+ }
29796
+ } else if (path19.isBinaryExpression()) {
29797
+ const type = inferAnnotationFromBinaryExpression(name, path19);
29798
29798
  if (type) types.push(type);
29799
29799
  }
29800
29800
  }
@@ -30615,12 +30615,12 @@ var require_hoister = __commonJS({
30615
30615
  variableDeclarator
30616
30616
  } = _t2;
30617
30617
  var referenceVisitor = {
30618
- ReferencedIdentifier(path14, state) {
30619
- if (path14.isJSXIdentifier() && react.isCompatTag(path14.node.name) && !path14.parentPath.isJSXMemberExpression()) {
30618
+ ReferencedIdentifier(path18, state) {
30619
+ if (path18.isJSXIdentifier() && react.isCompatTag(path18.node.name) && !path18.parentPath.isJSXMemberExpression()) {
30620
30620
  return;
30621
30621
  }
30622
- if (path14.node.name === "this") {
30623
- let scope = path14.scope;
30622
+ if (path18.node.name === "this") {
30623
+ let scope = path18.scope;
30624
30624
  do {
30625
30625
  if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
30626
30626
  break;
@@ -30628,21 +30628,21 @@ var require_hoister = __commonJS({
30628
30628
  } while (scope = scope.parent);
30629
30629
  if (scope) state.breakOnScopePaths.push(scope.path);
30630
30630
  }
30631
- const binding = path14.scope.getBinding(path14.node.name);
30631
+ const binding = path18.scope.getBinding(path18.node.name);
30632
30632
  if (!binding) return;
30633
30633
  for (const violation of binding.constantViolations) {
30634
30634
  if (violation.scope !== binding.path.scope) {
30635
30635
  state.mutableBinding = true;
30636
- path14.stop();
30636
+ path18.stop();
30637
30637
  return;
30638
30638
  }
30639
30639
  }
30640
- if (binding !== state.scope.getBinding(path14.node.name)) return;
30641
- state.bindings[path14.node.name] = binding;
30640
+ if (binding !== state.scope.getBinding(path18.node.name)) return;
30641
+ state.bindings[path18.node.name] = binding;
30642
30642
  }
30643
30643
  };
30644
30644
  var PathHoister = class {
30645
- constructor(path14, scope) {
30645
+ constructor(path18, scope) {
30646
30646
  this.breakOnScopePaths = void 0;
30647
30647
  this.bindings = void 0;
30648
30648
  this.mutableBinding = void 0;
@@ -30655,7 +30655,7 @@ var require_hoister = __commonJS({
30655
30655
  this.mutableBinding = false;
30656
30656
  this.scopes = [];
30657
30657
  this.scope = scope;
30658
- this.path = path14;
30658
+ this.path = path18;
30659
30659
  this.attachAfter = false;
30660
30660
  }
30661
30661
  isCompatibleScope(scope) {
@@ -30681,11 +30681,11 @@ var require_hoister = __commonJS({
30681
30681
  } while (scope = scope.parent);
30682
30682
  }
30683
30683
  getAttachmentPath() {
30684
- let path14 = this._getAttachmentPath();
30685
- if (!path14) return;
30686
- let targetScope = path14.scope;
30687
- if (targetScope.path === path14) {
30688
- targetScope = path14.scope.parent;
30684
+ let path18 = this._getAttachmentPath();
30685
+ if (!path18) return;
30686
+ let targetScope = path18.scope;
30687
+ if (targetScope.path === path18) {
30688
+ targetScope = path18.scope.parent;
30689
30689
  }
30690
30690
  if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
30691
30691
  for (const name of Object.keys(this.bindings)) {
@@ -30695,18 +30695,18 @@ var require_hoister = __commonJS({
30695
30695
  continue;
30696
30696
  }
30697
30697
  const bindingParentPath = this.getAttachmentParentForPath(binding.path);
30698
- if (bindingParentPath.key >= path14.key) {
30698
+ if (bindingParentPath.key >= path18.key) {
30699
30699
  this.attachAfter = true;
30700
- path14 = binding.path;
30700
+ path18 = binding.path;
30701
30701
  for (const violationPath of binding.constantViolations) {
30702
- if (this.getAttachmentParentForPath(violationPath).key > path14.key) {
30703
- path14 = violationPath;
30702
+ if (this.getAttachmentParentForPath(violationPath).key > path18.key) {
30703
+ path18 = violationPath;
30704
30704
  }
30705
30705
  }
30706
30706
  }
30707
30707
  }
30708
30708
  }
30709
- return path14;
30709
+ return path18;
30710
30710
  }
30711
30711
  _getAttachmentPath() {
30712
30712
  const scopes = this.scopes;
@@ -30731,13 +30731,13 @@ var require_hoister = __commonJS({
30731
30731
  const scope = this.scopes.pop();
30732
30732
  if (scope) return this.getAttachmentParentForPath(scope.path);
30733
30733
  }
30734
- getAttachmentParentForPath(path14) {
30734
+ getAttachmentParentForPath(path18) {
30735
30735
  do {
30736
- if (!path14.parentPath || Array.isArray(path14.container) && path14.isStatement()) {
30737
- return path14;
30736
+ if (!path18.parentPath || Array.isArray(path18.container) && path18.isStatement()) {
30737
+ return path18;
30738
30738
  }
30739
- } while (path14 = path14.parentPath);
30740
- return path14;
30739
+ } while (path18 = path18.parentPath);
30740
+ return path18;
30741
30741
  }
30742
30742
  hasOwnParamBindings(scope) {
30743
30743
  for (const name of Object.keys(this.bindings)) {
@@ -30839,18 +30839,18 @@ var require_modification = __commonJS({
30839
30839
  for (let i = 0; i < nodes.length; i++) {
30840
30840
  var _this$context;
30841
30841
  const to = from + i;
30842
- const path14 = this.getSibling(to);
30843
- paths.push(path14);
30842
+ const path18 = this.getSibling(to);
30843
+ paths.push(path18);
30844
30844
  if ((_this$context = this.context) != null && _this$context.queue) {
30845
- _context.pushContext.call(path14, this.context);
30845
+ _context.pushContext.call(path18, this.context);
30846
30846
  }
30847
30847
  }
30848
30848
  const contexts = _context._getQueueContexts.call(this);
30849
- for (const path14 of paths) {
30850
- _context.setScope.call(path14);
30851
- path14.debug("Inserted.");
30849
+ for (const path18 of paths) {
30850
+ _context.setScope.call(path18);
30851
+ path18.debug("Inserted.");
30852
30852
  for (const context of contexts) {
30853
- context.maybeQueue(path14, true);
30853
+ context.maybeQueue(path18, true);
30854
30854
  }
30855
30855
  }
30856
30856
  return paths;
@@ -30862,8 +30862,8 @@ var require_modification = __commonJS({
30862
30862
  return _containerInsert.call(this, this.key + 1, nodes);
30863
30863
  }
30864
30864
  var last = (arr) => arr[arr.length - 1];
30865
- function isHiddenInSequenceExpression(path14) {
30866
- return isSequenceExpression(path14.parent) && (last(path14.parent.expressions) !== path14.node || isHiddenInSequenceExpression(path14.parentPath));
30865
+ function isHiddenInSequenceExpression(path18) {
30866
+ return isSequenceExpression(path18.parent) && (last(path18.parent.expressions) !== path18.node || isHiddenInSequenceExpression(path18.parentPath));
30867
30867
  }
30868
30868
  function isAlmostConstantAssignment(node, scope) {
30869
30869
  if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {
@@ -30937,9 +30937,9 @@ var require_modification = __commonJS({
30937
30937
  if (!this.parent) return;
30938
30938
  const paths = (0, _cache.getCachedPaths)(this);
30939
30939
  if (!paths) return;
30940
- for (const [, path14] of paths) {
30941
- if (typeof path14.key === "number" && path14.container === this.container && path14.key >= fromIndex) {
30942
- path14.key += incrementBy;
30940
+ for (const [, path18] of paths) {
30941
+ if (typeof path18.key === "number" && path18.container === this.container && path18.key >= fromIndex) {
30942
+ path18.key += incrementBy;
30943
30943
  }
30944
30944
  }
30945
30945
  }
@@ -30973,27 +30973,27 @@ var require_modification = __commonJS({
30973
30973
  _removal._assertUnremoved.call(this);
30974
30974
  const verifiedNodes = _verifyNodeList.call(this, nodes);
30975
30975
  const container = this.node[listKey];
30976
- const path14 = _index.default.get({
30976
+ const path18 = _index.default.get({
30977
30977
  parentPath: this,
30978
30978
  parent: this.node,
30979
30979
  container,
30980
30980
  listKey,
30981
30981
  key: 0
30982
30982
  }).setContext(this.context);
30983
- return _containerInsertBefore.call(path14, verifiedNodes);
30983
+ return _containerInsertBefore.call(path18, verifiedNodes);
30984
30984
  }
30985
30985
  function pushContainer(listKey, nodes) {
30986
30986
  _removal._assertUnremoved.call(this);
30987
30987
  const verifiedNodes = _verifyNodeList.call(this, nodes);
30988
30988
  const container = this.node[listKey];
30989
- const path14 = _index.default.get({
30989
+ const path18 = _index.default.get({
30990
30990
  parentPath: this,
30991
30991
  parent: this.node,
30992
30992
  container,
30993
30993
  listKey,
30994
30994
  key: container.length
30995
30995
  }).setContext(this.context);
30996
- return path14.replaceWithMultiple(verifiedNodes);
30996
+ return path18.replaceWithMultiple(verifiedNodes);
30997
30997
  }
30998
30998
  exports.hoist = function hoist(scope = this.scope) {
30999
30999
  const hoister = new _hoister.default(this, scope);
@@ -45763,9 +45763,9 @@ var require_replacement = __commonJS({
45763
45763
  id
45764
45764
  }));
45765
45765
  const completionRecords = callee.getCompletionRecords();
45766
- for (const path14 of completionRecords) {
45767
- if (!path14.isExpressionStatement()) continue;
45768
- const loop = path14.findParent((path15) => path15.isLoop());
45766
+ for (const path18 of completionRecords) {
45767
+ if (!path18.isExpressionStatement()) continue;
45768
+ const loop = path18.findParent((path19) => path19.isLoop());
45769
45769
  if (loop) {
45770
45770
  let uid = loop.getData("expressionReplacementReturnUid");
45771
45771
  if (!uid) {
@@ -45775,9 +45775,9 @@ var require_replacement = __commonJS({
45775
45775
  } else {
45776
45776
  uid = identifier(uid.name);
45777
45777
  }
45778
- path14.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path14.node.expression));
45778
+ path18.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path18.node.expression));
45779
45779
  } else {
45780
- path14.replaceWith(returnStatement(path14.node.expression));
45780
+ path18.replaceWith(returnStatement(path18.node.expression));
45781
45781
  }
45782
45782
  }
45783
45783
  callee.arrowFunctionToExpression();
@@ -45886,16 +45886,16 @@ var require_evaluation = __commonJS({
45886
45886
  const res = this.evaluate();
45887
45887
  if (res.confident) return !!res.value;
45888
45888
  }
45889
- function deopt(path14, state) {
45889
+ function deopt(path18, state) {
45890
45890
  if (!state.confident) return;
45891
- state.deoptPath = path14;
45891
+ state.deoptPath = path18;
45892
45892
  state.confident = false;
45893
45893
  }
45894
45894
  var Globals = /* @__PURE__ */ new Map([["undefined", void 0], ["Infinity", Infinity], ["NaN", NaN]]);
45895
- function evaluateCached(path14, state) {
45895
+ function evaluateCached(path18, state) {
45896
45896
  const {
45897
45897
  node
45898
- } = path14;
45898
+ } = path18;
45899
45899
  const {
45900
45900
  seen
45901
45901
  } = state;
@@ -45904,7 +45904,7 @@ var require_evaluation = __commonJS({
45904
45904
  if (existing.resolved) {
45905
45905
  return existing.value;
45906
45906
  } else {
45907
- deopt(path14, state);
45907
+ deopt(path18, state);
45908
45908
  return;
45909
45909
  }
45910
45910
  } else {
@@ -45912,7 +45912,7 @@ var require_evaluation = __commonJS({
45912
45912
  resolved: false
45913
45913
  };
45914
45914
  seen.set(node, item);
45915
- const val = _evaluate(path14, state);
45915
+ const val = _evaluate(path18, state);
45916
45916
  if (state.confident) {
45917
45917
  item.resolved = true;
45918
45918
  item.value = val;
@@ -45920,55 +45920,55 @@ var require_evaluation = __commonJS({
45920
45920
  return val;
45921
45921
  }
45922
45922
  }
45923
- function _evaluate(path14, state) {
45923
+ function _evaluate(path18, state) {
45924
45924
  if (!state.confident) return;
45925
- if (path14.isSequenceExpression()) {
45926
- const exprs = path14.get("expressions");
45925
+ if (path18.isSequenceExpression()) {
45926
+ const exprs = path18.get("expressions");
45927
45927
  return evaluateCached(exprs[exprs.length - 1], state);
45928
45928
  }
45929
- if (path14.isStringLiteral() || path14.isNumericLiteral() || path14.isBooleanLiteral()) {
45930
- return path14.node.value;
45929
+ if (path18.isStringLiteral() || path18.isNumericLiteral() || path18.isBooleanLiteral()) {
45930
+ return path18.node.value;
45931
45931
  }
45932
- if (path14.isNullLiteral()) {
45932
+ if (path18.isNullLiteral()) {
45933
45933
  return null;
45934
45934
  }
45935
- if (path14.isTemplateLiteral()) {
45936
- return evaluateQuasis(path14, path14.node.quasis, state);
45935
+ if (path18.isTemplateLiteral()) {
45936
+ return evaluateQuasis(path18, path18.node.quasis, state);
45937
45937
  }
45938
- if (path14.isTaggedTemplateExpression() && path14.get("tag").isMemberExpression()) {
45939
- const object = path14.get("tag.object");
45938
+ if (path18.isTaggedTemplateExpression() && path18.get("tag").isMemberExpression()) {
45939
+ const object = path18.get("tag.object");
45940
45940
  const {
45941
45941
  node: {
45942
45942
  name
45943
45943
  }
45944
45944
  } = object;
45945
- const property = path14.get("tag.property");
45946
- if (object.isIdentifier() && name === "String" && !path14.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
45947
- return evaluateQuasis(path14, path14.node.quasi.quasis, state, true);
45945
+ const property = path18.get("tag.property");
45946
+ if (object.isIdentifier() && name === "String" && !path18.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
45947
+ return evaluateQuasis(path18, path18.node.quasi.quasis, state, true);
45948
45948
  }
45949
45949
  }
45950
- if (path14.isConditionalExpression()) {
45951
- const testResult = evaluateCached(path14.get("test"), state);
45950
+ if (path18.isConditionalExpression()) {
45951
+ const testResult = evaluateCached(path18.get("test"), state);
45952
45952
  if (!state.confident) return;
45953
45953
  if (testResult) {
45954
- return evaluateCached(path14.get("consequent"), state);
45954
+ return evaluateCached(path18.get("consequent"), state);
45955
45955
  } else {
45956
- return evaluateCached(path14.get("alternate"), state);
45956
+ return evaluateCached(path18.get("alternate"), state);
45957
45957
  }
45958
45958
  }
45959
- if (path14.isExpressionWrapper()) {
45960
- return evaluateCached(path14.get("expression"), state);
45959
+ if (path18.isExpressionWrapper()) {
45960
+ return evaluateCached(path18.get("expression"), state);
45961
45961
  }
45962
- if (path14.isMemberExpression() && !path14.parentPath.isCallExpression({
45963
- callee: path14.node
45962
+ if (path18.isMemberExpression() && !path18.parentPath.isCallExpression({
45963
+ callee: path18.node
45964
45964
  })) {
45965
- const property = path14.get("property");
45966
- const object = path14.get("object");
45965
+ const property = path18.get("property");
45966
+ const object = path18.get("object");
45967
45967
  if (object.isLiteral()) {
45968
45968
  const value = object.node.value;
45969
45969
  const type = typeof value;
45970
45970
  let key = null;
45971
- if (path14.node.computed) {
45971
+ if (path18.node.computed) {
45972
45972
  key = evaluateCached(property, state);
45973
45973
  if (!state.confident) return;
45974
45974
  } else if (property.isIdentifier()) {
@@ -45979,10 +45979,10 @@ var require_evaluation = __commonJS({
45979
45979
  }
45980
45980
  }
45981
45981
  }
45982
- if (path14.isReferencedIdentifier()) {
45983
- const binding = path14.scope.getBinding(path14.node.name);
45982
+ if (path18.isReferencedIdentifier()) {
45983
+ const binding = path18.scope.getBinding(path18.node.name);
45984
45984
  if (binding) {
45985
- if (binding.constantViolations.length > 0 || path14.node.start < binding.path.node.end) {
45985
+ if (binding.constantViolations.length > 0 || path18.node.start < binding.path.node.end) {
45986
45986
  deopt(binding.path, state);
45987
45987
  return;
45988
45988
  }
@@ -45991,7 +45991,7 @@ var require_evaluation = __commonJS({
45991
45991
  let hasUnsafeBlock = !bindingPathScope.path.parentPath.isBlockStatement();
45992
45992
  for (let scope = bindingPathScope.parent; scope; scope = scope.parent) {
45993
45993
  var _scope$path$parentPat;
45994
- if (scope === path14.scope) {
45994
+ if (scope === path18.scope) {
45995
45995
  if (hasUnsafeBlock) {
45996
45996
  deopt(binding.path, state);
45997
45997
  return;
@@ -46007,7 +46007,7 @@ var require_evaluation = __commonJS({
46007
46007
  return binding.value;
46008
46008
  }
46009
46009
  }
46010
- const name = path14.node.name;
46010
+ const name = path18.node.name;
46011
46011
  if (Globals.has(name)) {
46012
46012
  if (!binding) {
46013
46013
  return Globals.get(name);
@@ -46016,7 +46016,7 @@ var require_evaluation = __commonJS({
46016
46016
  return;
46017
46017
  }
46018
46018
  if (!binding) {
46019
- deopt(path14, state);
46019
+ deopt(path18, state);
46020
46020
  return;
46021
46021
  }
46022
46022
  const bindingPath = binding.path;
@@ -46037,19 +46037,19 @@ var require_evaluation = __commonJS({
46037
46037
  }
46038
46038
  return value;
46039
46039
  }
46040
- if (path14.isUnaryExpression({
46040
+ if (path18.isUnaryExpression({
46041
46041
  prefix: true
46042
46042
  })) {
46043
- if (path14.node.operator === "void") {
46043
+ if (path18.node.operator === "void") {
46044
46044
  return void 0;
46045
46045
  }
46046
- const argument = path14.get("argument");
46047
- if (path14.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
46046
+ const argument = path18.get("argument");
46047
+ if (path18.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
46048
46048
  return "function";
46049
46049
  }
46050
46050
  const arg = evaluateCached(argument, state);
46051
46051
  if (!state.confident) return;
46052
- switch (path14.node.operator) {
46052
+ switch (path18.node.operator) {
46053
46053
  case "!":
46054
46054
  return !arg;
46055
46055
  case "+":
@@ -46062,9 +46062,9 @@ var require_evaluation = __commonJS({
46062
46062
  return typeof arg;
46063
46063
  }
46064
46064
  }
46065
- if (path14.isArrayExpression()) {
46065
+ if (path18.isArrayExpression()) {
46066
46066
  const arr = [];
46067
- const elems = path14.get("elements");
46067
+ const elems = path18.get("elements");
46068
46068
  for (const elem of elems) {
46069
46069
  const elemValue = elem.evaluate();
46070
46070
  if (elemValue.confident) {
@@ -46076,9 +46076,9 @@ var require_evaluation = __commonJS({
46076
46076
  }
46077
46077
  return arr;
46078
46078
  }
46079
- if (path14.isObjectExpression()) {
46079
+ if (path18.isObjectExpression()) {
46080
46080
  const obj = {};
46081
- const props = path14.get("properties");
46081
+ const props = path18.get("properties");
46082
46082
  for (const prop of props) {
46083
46083
  if (prop.isObjectMethod() || prop.isSpreadElement()) {
46084
46084
  deopt(prop, state);
@@ -46109,14 +46109,14 @@ var require_evaluation = __commonJS({
46109
46109
  }
46110
46110
  return obj;
46111
46111
  }
46112
- if (path14.isLogicalExpression()) {
46112
+ if (path18.isLogicalExpression()) {
46113
46113
  const wasConfident = state.confident;
46114
- const left = evaluateCached(path14.get("left"), state);
46114
+ const left = evaluateCached(path18.get("left"), state);
46115
46115
  const leftConfident = state.confident;
46116
46116
  state.confident = wasConfident;
46117
- const right = evaluateCached(path14.get("right"), state);
46117
+ const right = evaluateCached(path18.get("right"), state);
46118
46118
  const rightConfident = state.confident;
46119
- switch (path14.node.operator) {
46119
+ switch (path18.node.operator) {
46120
46120
  case "||":
46121
46121
  state.confident = leftConfident && (!!left || rightConfident);
46122
46122
  if (!state.confident) return;
@@ -46131,12 +46131,12 @@ var require_evaluation = __commonJS({
46131
46131
  return left != null ? left : right;
46132
46132
  }
46133
46133
  }
46134
- if (path14.isBinaryExpression()) {
46135
- const left = evaluateCached(path14.get("left"), state);
46134
+ if (path18.isBinaryExpression()) {
46135
+ const left = evaluateCached(path18.get("left"), state);
46136
46136
  if (!state.confident) return;
46137
- const right = evaluateCached(path14.get("right"), state);
46137
+ const right = evaluateCached(path18.get("right"), state);
46138
46138
  if (!state.confident) return;
46139
- switch (path14.node.operator) {
46139
+ switch (path18.node.operator) {
46140
46140
  case "-":
46141
46141
  return left - right;
46142
46142
  case "+":
@@ -46179,11 +46179,11 @@ var require_evaluation = __commonJS({
46179
46179
  return left >>> right;
46180
46180
  }
46181
46181
  }
46182
- if (path14.isCallExpression()) {
46183
- const callee = path14.get("callee");
46182
+ if (path18.isCallExpression()) {
46183
+ const callee = path18.get("callee");
46184
46184
  let context;
46185
46185
  let func;
46186
- if (callee.isIdentifier() && !path14.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
46186
+ if (callee.isIdentifier() && !path18.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
46187
46187
  func = global[callee.node.name];
46188
46188
  }
46189
46189
  if (callee.isMemberExpression()) {
@@ -46205,17 +46205,17 @@ var require_evaluation = __commonJS({
46205
46205
  }
46206
46206
  }
46207
46207
  if (func) {
46208
- const args = path14.get("arguments").map((arg) => evaluateCached(arg, state));
46208
+ const args = path18.get("arguments").map((arg) => evaluateCached(arg, state));
46209
46209
  if (!state.confident) return;
46210
46210
  return func.apply(context, args);
46211
46211
  }
46212
46212
  }
46213
- deopt(path14, state);
46213
+ deopt(path18, state);
46214
46214
  }
46215
- function evaluateQuasis(path14, quasis, state, raw = false) {
46215
+ function evaluateQuasis(path18, quasis, state, raw = false) {
46216
46216
  let str = "";
46217
46217
  let i = 0;
46218
- const exprs = path14.isTemplateLiteral() ? path14.get("expressions") : path14.get("quasi.expressions");
46218
+ const exprs = path18.isTemplateLiteral() ? path18.get("expressions") : path18.get("quasi.expressions");
46219
46219
  for (const elem of quasis) {
46220
46220
  if (!state.confident) break;
46221
46221
  str += raw ? elem.value.raw : elem.value.cooked;
@@ -47009,8 +47009,8 @@ var require_conversion = __commonJS({
47009
47009
  }
47010
47010
  hoistFunctionEnvironment(this);
47011
47011
  }
47012
- function setType(path14, type) {
47013
- path14.node.type = type;
47012
+ function setType(path18, type) {
47013
+ path18.node.type = type;
47014
47014
  }
47015
47015
  function arrowFunctionToExpression({
47016
47016
  allowInsertArrow = true,
@@ -47425,14 +47425,14 @@ var require_conversion = __commonJS({
47425
47425
  return this;
47426
47426
  }
47427
47427
  var refersOuterBindingVisitor = {
47428
- "ReferencedIdentifier|BindingIdentifier"(path14, state) {
47429
- if (path14.node.name !== state.name) return;
47428
+ "ReferencedIdentifier|BindingIdentifier"(path18, state) {
47429
+ if (path18.node.name !== state.name) return;
47430
47430
  state.needsRename = true;
47431
- path14.stop();
47431
+ path18.stop();
47432
47432
  },
47433
- Scope(path14, state) {
47434
- if (path14.scope.hasOwnBinding(state.name)) {
47435
- path14.skip();
47433
+ Scope(path18, state) {
47434
+ if (path18.scope.hasOwnBinding(state.name)) {
47435
+ path18.skip();
47436
47436
  }
47437
47437
  }
47438
47438
  };
@@ -47581,21 +47581,21 @@ var require_introspection = __commonJS({
47581
47581
  return false;
47582
47582
  }
47583
47583
  function isCompletionRecord(allowInsideFunction) {
47584
- let path14 = this;
47584
+ let path18 = this;
47585
47585
  let first = true;
47586
47586
  do {
47587
47587
  const {
47588
47588
  type,
47589
47589
  container
47590
- } = path14;
47591
- if (!first && (path14.isFunction() || type === "StaticBlock")) {
47590
+ } = path18;
47591
+ if (!first && (path18.isFunction() || type === "StaticBlock")) {
47592
47592
  return !!allowInsideFunction;
47593
47593
  }
47594
47594
  first = false;
47595
- if (Array.isArray(container) && path14.key !== container.length - 1) {
47595
+ if (Array.isArray(container) && path18.key !== container.length - 1) {
47596
47596
  return false;
47597
47597
  }
47598
- } while ((path14 = path14.parentPath) && !path14.isProgram() && !path14.isDoExpression());
47598
+ } while ((path18 = path18.parentPath) && !path18.isProgram() && !path18.isDoExpression());
47599
47599
  return true;
47600
47600
  }
47601
47601
  function isStatementOrBlock() {
@@ -47617,21 +47617,21 @@ var require_introspection = __commonJS({
47617
47617
  }
47618
47618
  const binding = this.scope.getBinding(this.node.name);
47619
47619
  if ((binding == null ? void 0 : binding.kind) !== "module") return false;
47620
- const path14 = binding.path;
47621
- const parent = path14.parentPath;
47620
+ const path18 = binding.path;
47621
+ const parent = path18.parentPath;
47622
47622
  if (!parent.isImportDeclaration()) return false;
47623
47623
  if (parent.node.source.value === moduleSource) {
47624
47624
  if (!importName) return true;
47625
47625
  } else {
47626
47626
  return false;
47627
47627
  }
47628
- if (path14.isImportDefaultSpecifier() && importName === "default") {
47628
+ if (path18.isImportDefaultSpecifier() && importName === "default") {
47629
47629
  return true;
47630
47630
  }
47631
- if (path14.isImportNamespaceSpecifier() && importName === "*") {
47631
+ if (path18.isImportNamespaceSpecifier() && importName === "*") {
47632
47632
  return true;
47633
47633
  }
47634
- if (path14.isImportSpecifier() && isIdentifier(path14.node.imported, {
47634
+ if (path18.isImportSpecifier() && isIdentifier(path18.node.imported, {
47635
47635
  name: importName
47636
47636
  })) {
47637
47637
  return true;
@@ -47649,8 +47649,8 @@ var require_introspection = __commonJS({
47649
47649
  function willIMaybeExecuteBefore(target) {
47650
47650
  return this._guessExecutionStatusRelativeTo(target) !== "after";
47651
47651
  }
47652
- function getOuterFunction(path14) {
47653
- return path14.isProgram() ? path14 : (path14.parentPath.scope.getFunctionParent() || path14.parentPath.scope.getProgramParent()).path;
47652
+ function getOuterFunction(path18) {
47653
+ return path18.isProgram() ? path18 : (path18.parentPath.scope.getFunctionParent() || path18.parentPath.scope.getProgramParent()).path;
47654
47654
  }
47655
47655
  function isExecutionUncertain(type, key) {
47656
47656
  switch (type) {
@@ -47682,8 +47682,8 @@ var require_introspection = __commonJS({
47682
47682
  }
47683
47683
  function isExecutionUncertainInList(paths, maxIndex) {
47684
47684
  for (let i = 0; i < maxIndex; i++) {
47685
- const path14 = paths[i];
47686
- if (isExecutionUncertain(path14.parent.type, path14.parentKey)) {
47685
+ const path18 = paths[i];
47686
+ if (isExecutionUncertain(path18.parent.type, path18.parentKey)) {
47687
47687
  return true;
47688
47688
  }
47689
47689
  }
@@ -47713,10 +47713,10 @@ var require_introspection = __commonJS({
47713
47713
  this: 0
47714
47714
  };
47715
47715
  while (!commonPath && commonIndex.this < paths.this.length) {
47716
- const path14 = paths.this[commonIndex.this];
47717
- commonIndex.target = paths.target.indexOf(path14);
47716
+ const path18 = paths.this[commonIndex.this];
47717
+ commonIndex.target = paths.target.indexOf(path18);
47718
47718
  if (commonIndex.target >= 0) {
47719
- commonPath = path14;
47719
+ commonPath = path18;
47720
47720
  } else {
47721
47721
  commonIndex.this++;
47722
47722
  }
@@ -47754,13 +47754,13 @@ var require_introspection = __commonJS({
47754
47754
  if (!binding.references) return "before";
47755
47755
  const referencePaths = binding.referencePaths;
47756
47756
  let allStatus;
47757
- for (const path14 of referencePaths) {
47758
- const childOfFunction = !!path14.find((path15) => path15.node === target.node);
47757
+ for (const path18 of referencePaths) {
47758
+ const childOfFunction = !!path18.find((path19) => path19.node === target.node);
47759
47759
  if (childOfFunction) continue;
47760
- if (path14.key !== "callee" || !path14.parentPath.isCallExpression()) {
47760
+ if (path18.key !== "callee" || !path18.parentPath.isCallExpression()) {
47761
47761
  return "unknown";
47762
47762
  }
47763
- const status = _guessExecutionStatusRelativeToCached(base, path14, cache);
47763
+ const status = _guessExecutionStatusRelativeToCached(base, path18, cache);
47764
47764
  if (allStatus && allStatus !== status) {
47765
47765
  return "unknown";
47766
47766
  } else {
@@ -47878,19 +47878,19 @@ var require_introspection = __commonJS({
47878
47878
  }
47879
47879
  function isInStrictMode() {
47880
47880
  const start = this.isProgram() ? this : this.parentPath;
47881
- const strictParent = start.find((path14) => {
47882
- if (path14.isProgram({
47881
+ const strictParent = start.find((path18) => {
47882
+ if (path18.isProgram({
47883
47883
  sourceType: "module"
47884
47884
  })) return true;
47885
- if (path14.isClass()) return true;
47886
- if (path14.isArrowFunctionExpression() && !path14.get("body").isBlockStatement()) {
47885
+ if (path18.isClass()) return true;
47886
+ if (path18.isArrowFunctionExpression() && !path18.get("body").isBlockStatement()) {
47887
47887
  return false;
47888
47888
  }
47889
47889
  let body;
47890
- if (path14.isFunction()) {
47891
- body = path14.node.body;
47892
- } else if (path14.isProgram()) {
47893
- body = path14.node;
47890
+ if (path18.isFunction()) {
47891
+ body = path18.node.body;
47892
+ } else if (path18.isProgram()) {
47893
+ body = path18.node;
47894
47894
  } else {
47895
47895
  return false;
47896
47896
  }
@@ -47939,16 +47939,16 @@ var require_family = __commonJS({
47939
47939
  } = _t;
47940
47940
  var NORMAL_COMPLETION = 0;
47941
47941
  var BREAK_COMPLETION = 1;
47942
- function NormalCompletion(path14) {
47942
+ function NormalCompletion(path18) {
47943
47943
  return {
47944
47944
  type: NORMAL_COMPLETION,
47945
- path: path14
47945
+ path: path18
47946
47946
  };
47947
47947
  }
47948
- function BreakCompletion(path14) {
47948
+ function BreakCompletion(path18) {
47949
47949
  return {
47950
47950
  type: BREAK_COMPLETION,
47951
- path: path14
47951
+ path: path18
47952
47952
  };
47953
47953
  }
47954
47954
  function getOpposite() {
@@ -47959,9 +47959,9 @@ var require_family = __commonJS({
47959
47959
  }
47960
47960
  return null;
47961
47961
  }
47962
- function addCompletionRecords(path14, records, context) {
47963
- if (path14) {
47964
- records.push(..._getCompletionRecords(path14, context));
47962
+ function addCompletionRecords(path18, records, context) {
47963
+ if (path18) {
47964
+ records.push(..._getCompletionRecords(path18, context));
47965
47965
  }
47966
47966
  return records;
47967
47967
  }
@@ -48011,16 +48011,16 @@ var require_family = __commonJS({
48011
48011
  if (context.canHaveBreak) {
48012
48012
  let lastNormalCompletions = [];
48013
48013
  for (let i = 0; i < paths.length; i++) {
48014
- const path14 = paths[i];
48014
+ const path18 = paths[i];
48015
48015
  const newContext = Object.assign({}, context, {
48016
48016
  inCaseClause: false
48017
48017
  });
48018
- if (path14.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
48018
+ if (path18.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
48019
48019
  newContext.shouldPopulateBreak = true;
48020
48020
  } else {
48021
48021
  newContext.shouldPopulateBreak = false;
48022
48022
  }
48023
- const statementCompletions = _getCompletionRecords(path14, newContext);
48023
+ const statementCompletions = _getCompletionRecords(path18, newContext);
48024
48024
  if (statementCompletions.length > 0 && statementCompletions.every((c) => c.type === BREAK_COMPLETION)) {
48025
48025
  if (lastNormalCompletions.length > 0 && statementCompletions.every((c) => c.path.isBreakStatement({
48026
48026
  label: null
@@ -48070,35 +48070,35 @@ var require_family = __commonJS({
48070
48070
  }
48071
48071
  return completions;
48072
48072
  }
48073
- function _getCompletionRecords(path14, context) {
48073
+ function _getCompletionRecords(path18, context) {
48074
48074
  let records = [];
48075
- if (path14.isIfStatement()) {
48076
- records = addCompletionRecords(path14.get("consequent"), records, context);
48077
- records = addCompletionRecords(path14.get("alternate"), records, context);
48078
- } else if (path14.isDoExpression() || path14.isFor() || path14.isWhile() || path14.isLabeledStatement()) {
48079
- return addCompletionRecords(path14.get("body"), records, context);
48080
- } else if (path14.isProgram() || path14.isBlockStatement()) {
48081
- return getStatementListCompletion(path14.get("body"), context);
48082
- } else if (path14.isFunction()) {
48083
- return _getCompletionRecords(path14.get("body"), context);
48084
- } else if (path14.isTryStatement()) {
48085
- records = addCompletionRecords(path14.get("block"), records, context);
48086
- records = addCompletionRecords(path14.get("handler"), records, context);
48087
- } else if (path14.isCatchClause()) {
48088
- return addCompletionRecords(path14.get("body"), records, context);
48089
- } else if (path14.isSwitchStatement()) {
48090
- return completionRecordForSwitch(path14.get("cases"), records, context);
48091
- } else if (path14.isSwitchCase()) {
48092
- return getStatementListCompletion(path14.get("consequent"), {
48075
+ if (path18.isIfStatement()) {
48076
+ records = addCompletionRecords(path18.get("consequent"), records, context);
48077
+ records = addCompletionRecords(path18.get("alternate"), records, context);
48078
+ } else if (path18.isDoExpression() || path18.isFor() || path18.isWhile() || path18.isLabeledStatement()) {
48079
+ return addCompletionRecords(path18.get("body"), records, context);
48080
+ } else if (path18.isProgram() || path18.isBlockStatement()) {
48081
+ return getStatementListCompletion(path18.get("body"), context);
48082
+ } else if (path18.isFunction()) {
48083
+ return _getCompletionRecords(path18.get("body"), context);
48084
+ } else if (path18.isTryStatement()) {
48085
+ records = addCompletionRecords(path18.get("block"), records, context);
48086
+ records = addCompletionRecords(path18.get("handler"), records, context);
48087
+ } else if (path18.isCatchClause()) {
48088
+ return addCompletionRecords(path18.get("body"), records, context);
48089
+ } else if (path18.isSwitchStatement()) {
48090
+ return completionRecordForSwitch(path18.get("cases"), records, context);
48091
+ } else if (path18.isSwitchCase()) {
48092
+ return getStatementListCompletion(path18.get("consequent"), {
48093
48093
  canHaveBreak: true,
48094
48094
  shouldPopulateBreak: false,
48095
48095
  inCaseClause: true,
48096
48096
  shouldPreserveBreak: context.shouldPreserveBreak
48097
48097
  });
48098
- } else if (path14.isBreakStatement()) {
48099
- records.push(BreakCompletion(path14));
48098
+ } else if (path18.isBreakStatement()) {
48099
+ records.push(BreakCompletion(path18));
48100
48100
  } else {
48101
- records.push(NormalCompletion(path14));
48101
+ records.push(NormalCompletion(path18));
48102
48102
  }
48103
48103
  return records;
48104
48104
  }
@@ -48178,19 +48178,19 @@ var require_family = __commonJS({
48178
48178
  }
48179
48179
  }
48180
48180
  function _getPattern(parts, context) {
48181
- let path14 = this;
48181
+ let path18 = this;
48182
48182
  for (const part of parts) {
48183
48183
  if (part === ".") {
48184
- path14 = path14.parentPath;
48184
+ path18 = path18.parentPath;
48185
48185
  } else {
48186
- if (Array.isArray(path14)) {
48187
- path14 = path14[part];
48186
+ if (Array.isArray(path18)) {
48187
+ path18 = path18[part];
48188
48188
  } else {
48189
- path14 = path14.get(part, context);
48189
+ path18 = path18.get(part, context);
48190
48190
  }
48191
48191
  }
48192
48192
  }
48193
- return path14;
48193
+ return path18;
48194
48194
  }
48195
48195
  function getAssignmentIdentifiers() {
48196
48196
  return _getAssignmentIdentifiers(this.node);
@@ -48202,8 +48202,8 @@ var require_family = __commonJS({
48202
48202
  return _getOuterBindingIdentifiers(this.node, duplicates);
48203
48203
  }
48204
48204
  function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
48205
- const path14 = this;
48206
- const search = [path14];
48205
+ const path18 = this;
48206
+ const search = [path18];
48207
48207
  const ids = /* @__PURE__ */ Object.create(null);
48208
48208
  while (search.length) {
48209
48209
  const id = search.shift();
@@ -48402,13 +48402,13 @@ var require_path2 = __commonJS({
48402
48402
  }
48403
48403
  const targetNode = container[key];
48404
48404
  const paths = cache.getOrCreateCachedPaths(parent, parentPath);
48405
- let path14 = paths.get(targetNode);
48406
- if (!path14) {
48407
- path14 = new NodePath(hub, parent);
48408
- if (targetNode) paths.set(targetNode, path14);
48405
+ let path18 = paths.get(targetNode);
48406
+ if (!path18) {
48407
+ path18 = new NodePath(hub, parent);
48408
+ if (targetNode) paths.set(targetNode, path18);
48409
48409
  }
48410
- _context.setup.call(path14, parentPath, container, listKey, key);
48411
- return path14;
48410
+ _context.setup.call(path18, parentPath, container, listKey, key);
48411
+ return path18;
48412
48412
  }
48413
48413
  getScope(scope) {
48414
48414
  return this.isScope() ? new _index2.default(this) : scope;
@@ -48442,12 +48442,12 @@ var require_path2 = __commonJS({
48442
48442
  }
48443
48443
  getPathLocation() {
48444
48444
  const parts = [];
48445
- let path14 = this;
48445
+ let path18 = this;
48446
48446
  do {
48447
- let key = path14.key;
48448
- if (path14.inList) key = `${path14.listKey}[${key}]`;
48447
+ let key = path18.key;
48448
+ if (path18.inList) key = `${path18.listKey}[${key}]`;
48449
48449
  parts.unshift(key);
48450
- } while (path14 = path14.parentPath);
48450
+ } while (path18 = path18.parentPath);
48451
48451
  return parts.join(".");
48452
48452
  }
48453
48453
  debug(message) {
@@ -48679,12 +48679,12 @@ var require_context = __commonJS({
48679
48679
  hub
48680
48680
  });
48681
48681
  }
48682
- maybeQueue(path14, notPriority) {
48682
+ maybeQueue(path18, notPriority) {
48683
48683
  if (this.queue) {
48684
48684
  if (notPriority) {
48685
- this.queue.push(path14);
48685
+ this.queue.push(path18);
48686
48686
  } else {
48687
- this.priorityQueue.push(path14);
48687
+ this.priorityQueue.push(path18);
48688
48688
  }
48689
48689
  }
48690
48690
  }
@@ -48713,19 +48713,19 @@ var require_context = __commonJS({
48713
48713
  let stop = false;
48714
48714
  let visitIndex = 0;
48715
48715
  for (; visitIndex < queue.length; ) {
48716
- const path14 = queue[visitIndex];
48716
+ const path18 = queue[visitIndex];
48717
48717
  visitIndex++;
48718
- _context.resync.call(path14);
48719
- if (path14.contexts.length === 0 || path14.contexts[path14.contexts.length - 1] !== this) {
48720
- _context.pushContext.call(path14, this);
48718
+ _context.resync.call(path18);
48719
+ if (path18.contexts.length === 0 || path18.contexts[path18.contexts.length - 1] !== this) {
48720
+ _context.pushContext.call(path18, this);
48721
48721
  }
48722
- if (path14.key === null) continue;
48722
+ if (path18.key === null) continue;
48723
48723
  const {
48724
48724
  node
48725
- } = path14;
48725
+ } = path18;
48726
48726
  if (visited.has(node)) continue;
48727
48727
  if (node) visited.add(node);
48728
- if (path14.visit()) {
48728
+ if (path18.visit()) {
48729
48729
  stop = true;
48730
48730
  break;
48731
48731
  }
@@ -48771,13 +48771,13 @@ var require_traverse_node = __commonJS({
48771
48771
  var {
48772
48772
  VISITOR_KEYS
48773
48773
  } = _t;
48774
- function traverseNode(node, opts, scope, state, path14, skipKeys, visitSelf) {
48774
+ function traverseNode(node, opts, scope, state, path18, skipKeys, visitSelf) {
48775
48775
  const keys = VISITOR_KEYS[node.type];
48776
48776
  if (!keys) return false;
48777
- const context = new _context.default(scope, opts, state, path14);
48777
+ const context = new _context.default(scope, opts, state, path18);
48778
48778
  if (visitSelf) {
48779
- if (skipKeys != null && skipKeys[path14.parentKey]) return false;
48780
- return context.visitQueue([path14]);
48779
+ if (skipKeys != null && skipKeys[path18.parentKey]) return false;
48780
+ return context.visitQueue([path18]);
48781
48781
  }
48782
48782
  for (const key of keys) {
48783
48783
  if (skipKeys != null && skipKeys[key]) continue;
@@ -48859,11 +48859,11 @@ var require_context2 = __commonJS({
48859
48859
  return denylist == null ? void 0 : denylist.includes(this.node.type);
48860
48860
  }
48861
48861
  exports.isBlacklisted = isDenylisted;
48862
- function restoreContext(path14, context) {
48863
- if (path14.context !== context) {
48864
- path14.context = context;
48865
- path14.state = context.state;
48866
- path14.opts = context.opts;
48862
+ function restoreContext(path18, context) {
48863
+ if (path18.context !== context) {
48864
+ path18.context = context;
48865
+ path18.state = context.state;
48866
+ path18.opts = context.opts;
48867
48867
  }
48868
48868
  }
48869
48869
  function visit() {
@@ -48903,14 +48903,14 @@ var require_context2 = __commonJS({
48903
48903
  }
48904
48904
  function _forceSetScope() {
48905
48905
  var _this$scope;
48906
- let path14 = this.parentPath;
48907
- if ((this.key === "key" || this.listKey === "decorators") && path14.isMethod() || this.key === "discriminant" && path14.isSwitchStatement()) {
48908
- path14 = path14.parentPath;
48906
+ let path18 = this.parentPath;
48907
+ if ((this.key === "key" || this.listKey === "decorators") && path18.isMethod() || this.key === "discriminant" && path18.isSwitchStatement()) {
48908
+ path18 = path18.parentPath;
48909
48909
  }
48910
48910
  let target;
48911
- while (path14 && !target) {
48912
- target = path14.scope;
48913
- path14 = path14.parentPath;
48911
+ while (path18 && !target) {
48912
+ target = path18.scope;
48913
+ path18 = path18.parentPath;
48914
48914
  }
48915
48915
  this.scope = this.getScope(target);
48916
48916
  (_this$scope = this.scope) == null || _this$scope.init();
@@ -48918,16 +48918,16 @@ var require_context2 = __commonJS({
48918
48918
  function setScope() {
48919
48919
  var _this$opts2, _this$scope2;
48920
48920
  if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return;
48921
- let path14 = this.parentPath;
48922
- if ((this.key === "key" || this.listKey === "decorators") && path14.isMethod() || this.key === "discriminant" && path14.isSwitchStatement()) {
48923
- path14 = path14.parentPath;
48921
+ let path18 = this.parentPath;
48922
+ if ((this.key === "key" || this.listKey === "decorators") && path18.isMethod() || this.key === "discriminant" && path18.isSwitchStatement()) {
48923
+ path18 = path18.parentPath;
48924
48924
  }
48925
48925
  let target;
48926
- while (path14 && !target) {
48926
+ while (path18 && !target) {
48927
48927
  var _path$opts;
48928
- if ((_path$opts = path14.opts) != null && _path$opts.noScope) return;
48929
- target = path14.scope;
48930
- path14 = path14.parentPath;
48928
+ if ((_path$opts = path18.opts) != null && _path$opts.noScope) return;
48929
+ target = path18.scope;
48930
+ path18 = path18.parentPath;
48931
48931
  }
48932
48932
  this.scope = this.getScope(target);
48933
48933
  (_this$scope2 = this.scope) == null || _this$scope2.init();
@@ -49035,12 +49035,12 @@ var require_context2 = __commonJS({
49035
49035
  }
49036
49036
  }
49037
49037
  function _getQueueContexts() {
49038
- let path14 = this;
49038
+ let path18 = this;
49039
49039
  let contexts = this.contexts;
49040
49040
  while (!contexts.length) {
49041
- path14 = path14.parentPath;
49042
- if (!path14) break;
49043
- contexts = path14.contexts;
49041
+ path18 = path18.parentPath;
49042
+ if (!path18) break;
49043
+ contexts = path18.contexts;
49044
49044
  }
49045
49045
  return contexts;
49046
49046
  }
@@ -49111,8 +49111,8 @@ var require_lib8 = __commonJS({
49111
49111
  traverseFast(node, enter);
49112
49112
  return;
49113
49113
  };
49114
- traverse2.node = function(node, opts, scope, state, path14, skipKeys) {
49115
- (0, _traverseNode.traverseNode)(node, opts, scope, state, path14, skipKeys);
49114
+ traverse2.node = function(node, opts, scope, state, path18, skipKeys) {
49115
+ (0, _traverseNode.traverseNode)(node, opts, scope, state, path18, skipKeys);
49116
49116
  };
49117
49117
  traverse2.clearNode = function(node, opts) {
49118
49118
  removeProperties(node, opts);
@@ -49168,6 +49168,13 @@ var OptionsConfigSchema = z.object({
49168
49168
  require_review_for_ambiguous_strings: z.boolean().default(true),
49169
49169
  require_review_for_stale_translations: z.boolean().default(true)
49170
49170
  });
49171
+ var CloudConfigSchema = z.object({
49172
+ project_id: z.string().min(1),
49173
+ workspace: z.string().optional(),
49174
+ dashboard_url: z.string().url().default("https://dash.shallok.com"),
49175
+ cdn_url: z.string().url().optional(),
49176
+ auto_publish: z.boolean().default(true)
49177
+ });
49171
49178
  var LocalizationManifestSchema = z.object({
49172
49179
  schema_version: z.number().int().default(1),
49173
49180
  localization_version: z.number().int().default(1),
@@ -49175,6 +49182,7 @@ var LocalizationManifestSchema = z.object({
49175
49182
  supported_locales: z.array(z.string().min(2)),
49176
49183
  framework: FrameworkConfigSchema,
49177
49184
  paths: PathsConfigSchema,
49185
+ cloud: CloudConfigSchema.optional(),
49178
49186
  key_strategy: z.enum(["semantic", "hierarchical", "hash"]).default("semantic"),
49179
49187
  translation: TranslationConfigSchema,
49180
49188
  options: OptionsConfigSchema
@@ -50031,32 +50039,32 @@ function extractStringsFromSource(options) {
50031
50039
  }
50032
50040
  traverse(ast, {
50033
50041
  // 1. Skip imports
50034
- ImportDeclaration(path14) {
50035
- path14.skip();
50042
+ ImportDeclaration(path18) {
50043
+ path18.skip();
50036
50044
  },
50037
50045
  // 2. Skip console and logger calls
50038
- CallExpression(path14) {
50039
- const callee = path14.node.callee;
50046
+ CallExpression(path18) {
50047
+ const callee = path18.node.callee;
50040
50048
  if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && (callee.object.name === "console" || callee.object.name === "logger")) {
50041
- path14.skip();
50049
+ path18.skip();
50042
50050
  return;
50043
50051
  }
50044
50052
  if (t.isIdentifier(callee, { name: "t" }) || t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: "i18n" }) && t.isIdentifier(callee.property, { name: "t" })) {
50045
- path14.skip();
50053
+ path18.skip();
50046
50054
  return;
50047
50055
  }
50048
50056
  },
50049
50057
  // 3. Extract JSXText
50050
- JSXText(path14) {
50051
- const text = path14.node.value;
50058
+ JSXText(path18) {
50059
+ const text = path18.node.value;
50052
50060
  const trimmed = text.trim();
50053
50061
  if (!isLikelyUserFacingText(trimmed)) {
50054
50062
  return;
50055
50063
  }
50056
- const line = path14.node.loc?.start.line || 1;
50057
- const column = path14.node.loc?.start.column || 0;
50058
- const tagName = path14.parent?.openingElement?.name?.name || "element";
50059
- const { context: richContext, hasExplicitComment } = deriveEnclosingContext(path14, `JSX text in <${tagName}>`);
50064
+ const line = path18.node.loc?.start.line || 1;
50065
+ const column = path18.node.loc?.start.column || 0;
50066
+ const tagName = path18.parent?.openingElement?.name?.name || "element";
50067
+ const { context: richContext, hasExplicitComment } = deriveEnclosingContext(path18, `JSX text in <${tagName}>`);
50060
50068
  const suggestedKey = generateSemanticKey({
50061
50069
  filePath,
50062
50070
  content: trimmed,
@@ -50077,15 +50085,15 @@ function extractStringsFromSource(options) {
50077
50085
  });
50078
50086
  },
50079
50087
  // 4. Extract JSXAttribute (e.g. placeholder, aria-label, title)
50080
- JSXAttribute(path14) {
50081
- const attrName = path14.node.name.name;
50088
+ JSXAttribute(path18) {
50089
+ const attrName = path18.node.name.name;
50082
50090
  if (typeof attrName !== "string" || isIgnoredAttribute(attrName)) {
50083
50091
  return;
50084
50092
  }
50085
50093
  if (!isUserFacingAttribute(attrName)) {
50086
50094
  return;
50087
50095
  }
50088
- const val = path14.node.value;
50096
+ const val = path18.node.value;
50089
50097
  if (t.isStringLiteral(val)) {
50090
50098
  const trimmed = val.value.trim();
50091
50099
  if (!isLikelyUserFacingText(trimmed)) {
@@ -50093,7 +50101,7 @@ function extractStringsFromSource(options) {
50093
50101
  }
50094
50102
  const line = val.loc?.start.line || 1;
50095
50103
  const column = val.loc?.start.column || 0;
50096
- const { context: richContext, hasExplicitComment } = deriveEnclosingContext(path14, `${attrName} attribute`);
50104
+ const { context: richContext, hasExplicitComment } = deriveEnclosingContext(path18, `${attrName} attribute`);
50097
50105
  const suggestedKey = generateSemanticKey({
50098
50106
  filePath,
50099
50107
  content: trimmed,
@@ -50115,8 +50123,8 @@ function extractStringsFromSource(options) {
50115
50123
  }
50116
50124
  },
50117
50125
  // 5. Extract string literals inside JSXExpressionContainer conditional or logical expressions
50118
- JSXExpressionContainer(path14) {
50119
- path14.traverse({
50126
+ JSXExpressionContainer(path18) {
50127
+ path18.traverse({
50120
50128
  StringLiteral(subPath) {
50121
50129
  if (t.isConditionalExpression(subPath.parent) || t.isLogicalExpression(subPath.parent)) {
50122
50130
  const trimmed = subPath.node.value.trim();
@@ -50174,22 +50182,22 @@ function transformSourceFile(options) {
50174
50182
  const extractedKeys = [];
50175
50183
  let modified = false;
50176
50184
  traverse(ast, {
50177
- ImportDeclaration(path14) {
50178
- path14.skip();
50185
+ ImportDeclaration(path18) {
50186
+ path18.skip();
50179
50187
  },
50180
- CallExpression(path14) {
50181
- const callee = path14.node.callee;
50188
+ CallExpression(path18) {
50189
+ const callee = path18.node.callee;
50182
50190
  if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && (callee.object.name === "console" || callee.object.name === "logger")) {
50183
- path14.skip();
50191
+ path18.skip();
50184
50192
  return;
50185
50193
  }
50186
50194
  if (t.isIdentifier(callee, { name: "t" }) || t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: "i18n" }) && t.isIdentifier(callee.property, { name: "t" })) {
50187
- path14.skip();
50195
+ path18.skip();
50188
50196
  return;
50189
50197
  }
50190
50198
  },
50191
- JSXText(path14) {
50192
- const text = path14.node.value;
50199
+ JSXText(path18) {
50200
+ const text = path18.node.value;
50193
50201
  const trimmed = text.trim();
50194
50202
  if (!isLikelyUserFacingText(trimmed)) {
50195
50203
  return;
@@ -50202,15 +50210,15 @@ function transformSourceFile(options) {
50202
50210
  existingKeys.set(key, trimmed);
50203
50211
  extractedKeys.push(key);
50204
50212
  const replacement = t.jsxExpressionContainer(t.callExpression(t.identifier("t"), [t.stringLiteral(key)]));
50205
- path14.replaceWith(replacement);
50213
+ path18.replaceWith(replacement);
50206
50214
  modified = true;
50207
50215
  },
50208
- JSXAttribute(path14) {
50209
- const attrName = path14.node.name.name;
50216
+ JSXAttribute(path18) {
50217
+ const attrName = path18.node.name.name;
50210
50218
  if (typeof attrName !== "string" || isIgnoredAttribute(attrName) || !isUserFacingAttribute(attrName)) {
50211
50219
  return;
50212
50220
  }
50213
- const val = path14.node.value;
50221
+ const val = path18.node.value;
50214
50222
  if (t.isStringLiteral(val)) {
50215
50223
  const trimmed = val.value.trim();
50216
50224
  if (!isLikelyUserFacingText(trimmed)) {
@@ -50225,12 +50233,12 @@ function transformSourceFile(options) {
50225
50233
  existingKeys.set(key, trimmed);
50226
50234
  extractedKeys.push(key);
50227
50235
  const replacement = t.jsxExpressionContainer(t.callExpression(t.identifier("t"), [t.stringLiteral(key)]));
50228
- path14.node.value = replacement;
50236
+ path18.node.value = replacement;
50229
50237
  modified = true;
50230
50238
  }
50231
50239
  },
50232
- JSXExpressionContainer(path14) {
50233
- path14.traverse({
50240
+ JSXExpressionContainer(path18) {
50241
+ path18.traverse({
50234
50242
  StringLiteral(subPath) {
50235
50243
  if (t.isConditionalExpression(subPath.parent) || t.isLogicalExpression(subPath.parent)) {
50236
50244
  const trimmed = subPath.node.value.trim();
@@ -50281,9 +50289,9 @@ function injectHookAndImport(options) {
50281
50289
  const { ast, hookName, packageName } = options;
50282
50290
  let hasImport = false;
50283
50291
  traverse(ast, {
50284
- ImportDeclaration(path14) {
50285
- if (path14.node.source.value === packageName) {
50286
- for (const spec of path14.node.specifiers) {
50292
+ ImportDeclaration(path18) {
50293
+ if (path18.node.source.value === packageName) {
50294
+ for (const spec of path18.node.specifiers) {
50287
50295
  if (t.isImportSpecifier(spec) && spec.imported.name === hookName) {
50288
50296
  hasImport = true;
50289
50297
  }
@@ -50297,17 +50305,17 @@ function injectHookAndImport(options) {
50297
50305
  ast.program.body.unshift(importDecl);
50298
50306
  }
50299
50307
  traverse(ast, {
50300
- FunctionDeclaration(path14) {
50301
- injectHookIntoBody(path14.node.body, hookName);
50308
+ FunctionDeclaration(path18) {
50309
+ injectHookIntoBody(path18.node.body, hookName);
50302
50310
  },
50303
- FunctionExpression(path14) {
50304
- if (t.isBlockStatement(path14.node.body)) {
50305
- injectHookIntoBody(path14.node.body, hookName);
50311
+ FunctionExpression(path18) {
50312
+ if (t.isBlockStatement(path18.node.body)) {
50313
+ injectHookIntoBody(path18.node.body, hookName);
50306
50314
  }
50307
50315
  },
50308
- ArrowFunctionExpression(path14) {
50309
- if (t.isBlockStatement(path14.node.body)) {
50310
- injectHookIntoBody(path14.node.body, hookName);
50316
+ ArrowFunctionExpression(path18) {
50317
+ if (t.isBlockStatement(path18.node.body)) {
50318
+ injectHookIntoBody(path18.node.body, hookName);
50311
50319
  }
50312
50320
  }
50313
50321
  });
@@ -50341,8 +50349,8 @@ function injectHookIntoBody(body, hookName) {
50341
50349
  body.body.unshift(hookStatement);
50342
50350
  }
50343
50351
  }
50344
- function deriveEnclosingContext(path14, fallback) {
50345
- const comments = path14.node.leadingComments || path14.parent?.leadingComments || [];
50352
+ function deriveEnclosingContext(path18, fallback) {
50353
+ const comments = path18.node.leadingComments || path18.parent?.leadingComments || [];
50346
50354
  for (const c of comments) {
50347
50355
  const val = (c.value || "").trim();
50348
50356
  if (/^(context|i18n-context|desc|description):/i.test(val)) {
@@ -50351,7 +50359,7 @@ function deriveEnclosingContext(path14, fallback) {
50351
50359
  }
50352
50360
  }
50353
50361
  let componentName = "";
50354
- let curr = path14.parentPath;
50362
+ let curr = path18.parentPath;
50355
50363
  while (curr) {
50356
50364
  if (curr.isFunctionDeclaration && curr.isFunctionDeclaration()) {
50357
50365
  componentName = curr.node.id?.name || "";
@@ -50364,7 +50372,7 @@ function deriveEnclosingContext(path14, fallback) {
50364
50372
  curr = curr.parentPath;
50365
50373
  }
50366
50374
  let tagInfo = "";
50367
- let parentEl = path14.findParent ? path14.findParent((p) => p.isJSXElement && p.isJSXElement()) : null;
50375
+ let parentEl = path18.findParent ? path18.findParent((p) => p.isJSXElement && p.isJSXElement()) : null;
50368
50376
  if (parentEl && parentEl.node?.openingElement) {
50369
50377
  const opening = parentEl.node.openingElement;
50370
50378
  const tagName = opening.name?.name || "element";
@@ -50501,6 +50509,8 @@ async function analyzeCommand(options) {
50501
50509
  }
50502
50510
 
50503
50511
  // src/commands/setup.ts
50512
+ import path7 from "path";
50513
+ import fs5 from "fs/promises";
50504
50514
  import chalk2 from "chalk";
50505
50515
 
50506
50516
  // src/installer/skills-installer.ts
@@ -50534,7 +50544,7 @@ function resolveCliVersion() {
50534
50544
  }
50535
50545
  } catch {
50536
50546
  }
50537
- return "0.1.4";
50547
+ return "0.1.5";
50538
50548
  }
50539
50549
  var CLI_VERSION = resolveCliVersion();
50540
50550
 
@@ -50573,10 +50583,16 @@ async function ensureShallokDependency(projectRoot) {
50573
50583
  if (pkg.name === "shallok-monorepo") return false;
50574
50584
  const hasShallok = Boolean(pkg.dependencies?.shallok || pkg.dependencies?.["@shallok/cli"]) || Boolean(pkg.devDependencies?.shallok || pkg.devDependencies?.["@shallok/cli"]);
50575
50585
  if (hasShallok) return false;
50586
+ if (process.env.VITEST || process.env.NODE_ENV === "test") {
50587
+ pkg.devDependencies = pkg.devDependencies || {};
50588
+ pkg.devDependencies["shallok"] = `^${CLI_VERSION}`;
50589
+ await fs4.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
50590
+ return true;
50591
+ }
50576
50592
  const pm = await detectPackageManager(projectRoot);
50577
50593
  const installCmd = pm === "pnpm" ? "pnpm add -D shallok" : pm === "yarn" ? "yarn add -D shallok" : pm === "bun" ? "bun add -d shallok" : "npm install -D shallok";
50578
50594
  try {
50579
- await execAsync(installCmd, { cwd: projectRoot });
50595
+ await execAsync(installCmd, { cwd: projectRoot, timeout: 1e4 });
50580
50596
  return true;
50581
50597
  } catch {
50582
50598
  pkg.devDependencies = pkg.devDependencies || {};
@@ -50684,6 +50700,24 @@ async function setupCommand(options) {
50684
50700
  for (const skill of result.copiedSkills) {
50685
50701
  printer.info(`Added AI agent skill: ${skill} (.agents/skills/)`);
50686
50702
  }
50703
+ try {
50704
+ const cursorDir = path7.join(cwd, ".cursor");
50705
+ await fs5.mkdir(cursorDir, { recursive: true });
50706
+ const cursorMcpPath = path7.join(cursorDir, "mcp.json");
50707
+ let existingMcp = { mcpServers: {} };
50708
+ try {
50709
+ existingMcp = JSON.parse(await fs5.readFile(cursorMcpPath, "utf-8"));
50710
+ if (!existingMcp.mcpServers) existingMcp.mcpServers = {};
50711
+ } catch {
50712
+ }
50713
+ existingMcp.mcpServers["shallok"] = {
50714
+ command: "npx",
50715
+ args: ["shallok", "mcp"]
50716
+ };
50717
+ await fs5.writeFile(cursorMcpPath, JSON.stringify(existingMcp, null, 2), "utf-8");
50718
+ printer.info("Configured Shallok MCP server in .cursor/mcp.json");
50719
+ } catch {
50720
+ }
50687
50721
  console.log("");
50688
50722
  console.log(chalk2.bold.cyan("======================================================================"));
50689
50723
  console.log(chalk2.bold(" Next Step: Ask your AI agent to localize your app!"));
@@ -50699,6 +50733,12 @@ async function setupCommand(options) {
50699
50733
  console.log(" 2. Extract hardcoded UI strings into canonical catalog (shallok extract)");
50700
50734
  console.log(" 3. Generate translations without external API keys (shallok translate)");
50701
50735
  console.log(" 4. Wire up framework runtime provider and compile message bundles");
50736
+ console.log(" 5. Synchronize with Shallok Dashboard & Edge CDN via Shallok MCP");
50737
+ console.log("");
50738
+ console.log(chalk2.bold(" Cloud Sync & Global CDN:"));
50739
+ console.log(" To link your project and publish translations to the Global Edge CDN:");
50740
+ console.log(chalk2.green(" npx shallok link --token <shk_live_...>"));
50741
+ console.log(chalk2.dim(" (Generate tokens at https://dash.shallok.com/mcp)"));
50702
50742
  console.log(chalk2.bold.cyan("======================================================================"));
50703
50743
  } catch (err) {
50704
50744
  printer.error(`Setup failed: ${err.message}`);
@@ -50707,8 +50747,8 @@ async function setupCommand(options) {
50707
50747
  }
50708
50748
 
50709
50749
  // src/commands/init.ts
50710
- import path12 from "path";
50711
- import fs10 from "fs/promises";
50750
+ import path13 from "path";
50751
+ import fs11 from "fs/promises";
50712
50752
 
50713
50753
  // ../../packages/framework-adapters/dist/common/compile.js
50714
50754
  function setNestedProperty(obj, keyPath, value) {
@@ -50741,23 +50781,23 @@ function compileCatalogToRuntime(localeCatalog, canonicalCatalog, format = "flat
50741
50781
  }
50742
50782
 
50743
50783
  // ../../packages/framework-adapters/dist/react/adapter.js
50744
- import fs5 from "fs/promises";
50745
- import path7 from "path";
50784
+ import fs6 from "fs/promises";
50785
+ import path8 from "path";
50746
50786
  var ReactAdapter = class {
50747
50787
  name = "react";
50748
50788
  framework = "react";
50749
50789
  library = "react-i18next";
50750
50790
  async detect(projectRoot) {
50751
- const pkg = await readJsonIfExists(path7.resolve(projectRoot, "package.json"));
50791
+ const pkg = await readJsonIfExists(path8.resolve(projectRoot, "package.json"));
50752
50792
  if (!pkg?.dependencies)
50753
50793
  return false;
50754
50794
  return Boolean(pkg.dependencies["react"] && !pkg.dependencies["next"]);
50755
50795
  }
50756
50796
  async initialize(projectRoot, options) {
50757
50797
  const createdFiles = [];
50758
- const srcDir = path7.resolve(projectRoot, "src");
50759
- await fs5.mkdir(srcDir, { recursive: true });
50760
- const i18nConfigPath = path7.resolve(srcDir, "i18n.ts");
50798
+ const srcDir = path8.resolve(projectRoot, "src");
50799
+ await fs6.mkdir(srcDir, { recursive: true });
50800
+ const i18nConfigPath = path8.resolve(srcDir, "i18n.ts");
50761
50801
  const configContent = `import i18n from 'i18next';
50762
50802
  import { initReactI18next } from 'react-i18next';
50763
50803
 
@@ -50780,7 +50820,7 @@ i18n
50780
50820
 
50781
50821
  export default i18n;
50782
50822
  `;
50783
- await fs5.writeFile(i18nConfigPath, configContent, "utf8");
50823
+ await fs6.writeFile(i18nConfigPath, configContent, "utf8");
50784
50824
  createdFiles.push("src/i18n.ts");
50785
50825
  return {
50786
50826
  createdFiles,
@@ -50799,39 +50839,39 @@ export default i18n;
50799
50839
  async writeRuntimeMessages(projectRoot, options) {
50800
50840
  const compiled = this.compileRuntimeMessages(options);
50801
50841
  const writtenFiles = [];
50802
- const outDir = path7.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
50803
- await fs5.mkdir(outDir, { recursive: true });
50842
+ const outDir = path8.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
50843
+ await fs6.mkdir(outDir, { recursive: true });
50804
50844
  for (const [locale, messages] of Object.entries(compiled)) {
50805
- const filePath = path7.resolve(outDir, `${locale}.json`);
50845
+ const filePath = path8.resolve(outDir, `${locale}.json`);
50806
50846
  await writeJsonAtomic(filePath, messages);
50807
- writtenFiles.push(path7.relative(projectRoot, filePath));
50847
+ writtenFiles.push(path8.relative(projectRoot, filePath));
50808
50848
  }
50809
50849
  return writtenFiles;
50810
50850
  }
50811
50851
  };
50812
50852
 
50813
50853
  // ../../packages/framework-adapters/dist/nextjs/adapter.js
50814
- import fs6 from "fs/promises";
50815
- import path8 from "path";
50854
+ import fs7 from "fs/promises";
50855
+ import path9 from "path";
50816
50856
  var NextjsAdapter = class {
50817
50857
  name = "nextjs";
50818
50858
  framework = "nextjs";
50819
50859
  library = "next-intl";
50820
50860
  async detect(projectRoot) {
50821
- const pkg = await readJsonIfExists(path8.resolve(projectRoot, "package.json"));
50861
+ const pkg = await readJsonIfExists(path9.resolve(projectRoot, "package.json"));
50822
50862
  return Boolean(pkg?.dependencies?.["next"]);
50823
50863
  }
50824
50864
  async initialize(projectRoot, options) {
50825
50865
  const createdFiles = [];
50826
50866
  let baseDir = "src";
50827
50867
  try {
50828
- await fs6.access(path8.resolve(projectRoot, "src"));
50868
+ await fs7.access(path9.resolve(projectRoot, "src"));
50829
50869
  } catch {
50830
50870
  baseDir = ".";
50831
50871
  }
50832
- const i18nDir = path8.resolve(projectRoot, baseDir, "i18n");
50833
- await fs6.mkdir(i18nDir, { recursive: true });
50834
- const routingPath = path8.resolve(i18nDir, "routing.ts");
50872
+ const i18nDir = path9.resolve(projectRoot, baseDir, "i18n");
50873
+ await fs7.mkdir(i18nDir, { recursive: true });
50874
+ const routingPath = path9.resolve(i18nDir, "routing.ts");
50835
50875
  const routingContent = `import { defineRouting } from 'next-intl/routing';
50836
50876
 
50837
50877
  export const routing = defineRouting({
@@ -50839,9 +50879,9 @@ export const routing = defineRouting({
50839
50879
  defaultLocale: '${options.sourceLocale}',
50840
50880
  });
50841
50881
  `;
50842
- await fs6.writeFile(routingPath, routingContent, "utf8");
50843
- createdFiles.push(path8.relative(projectRoot, routingPath));
50844
- const requestPath = path8.resolve(i18nDir, "request.ts");
50882
+ await fs7.writeFile(routingPath, routingContent, "utf8");
50883
+ createdFiles.push(path9.relative(projectRoot, routingPath));
50884
+ const requestPath = path9.resolve(i18nDir, "request.ts");
50845
50885
  const requestContent = `import { getRequestConfig } from 'next-intl/server';
50846
50886
  import { routing } from './routing';
50847
50887
 
@@ -50858,8 +50898,8 @@ export default getRequestConfig(async ({ requestLocale }) => {
50858
50898
  };
50859
50899
  });
50860
50900
  `;
50861
- await fs6.writeFile(requestPath, requestContent, "utf8");
50862
- createdFiles.push(path8.relative(projectRoot, requestPath));
50901
+ await fs7.writeFile(requestPath, requestContent, "utf8");
50902
+ createdFiles.push(path9.relative(projectRoot, requestPath));
50863
50903
  return {
50864
50904
  createdFiles,
50865
50905
  modifiedFiles: [],
@@ -50877,33 +50917,33 @@ export default getRequestConfig(async ({ requestLocale }) => {
50877
50917
  async writeRuntimeMessages(projectRoot, options) {
50878
50918
  const compiled = this.compileRuntimeMessages(options);
50879
50919
  const writtenFiles = [];
50880
- const outDir = path8.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
50881
- await fs6.mkdir(outDir, { recursive: true });
50920
+ const outDir = path9.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
50921
+ await fs7.mkdir(outDir, { recursive: true });
50882
50922
  for (const [locale, messages] of Object.entries(compiled)) {
50883
- const filePath = path8.resolve(outDir, `${locale}.json`);
50923
+ const filePath = path9.resolve(outDir, `${locale}.json`);
50884
50924
  await writeJsonAtomic(filePath, messages);
50885
- writtenFiles.push(path8.relative(projectRoot, filePath));
50925
+ writtenFiles.push(path9.relative(projectRoot, filePath));
50886
50926
  }
50887
50927
  return writtenFiles;
50888
50928
  }
50889
50929
  };
50890
50930
 
50891
50931
  // ../../packages/framework-adapters/dist/vue/adapter.js
50892
- import fs7 from "fs/promises";
50893
- import path9 from "path";
50932
+ import fs8 from "fs/promises";
50933
+ import path10 from "path";
50894
50934
  var VueAdapter = class {
50895
50935
  name = "vue";
50896
50936
  framework = "vue";
50897
50937
  library = "vue-i18n";
50898
50938
  async detect(projectRoot) {
50899
- const pkg = await readJsonIfExists(path9.resolve(projectRoot, "package.json"));
50939
+ const pkg = await readJsonIfExists(path10.resolve(projectRoot, "package.json"));
50900
50940
  return Boolean(pkg?.dependencies?.["vue"]);
50901
50941
  }
50902
50942
  async initialize(projectRoot, options) {
50903
50943
  const createdFiles = [];
50904
- const srcDir = path9.resolve(projectRoot, "src");
50905
- await fs7.mkdir(srcDir, { recursive: true });
50906
- const i18nConfigPath = path9.resolve(srcDir, "i18n.ts");
50944
+ const srcDir = path10.resolve(projectRoot, "src");
50945
+ await fs8.mkdir(srcDir, { recursive: true });
50946
+ const i18nConfigPath = path10.resolve(srcDir, "i18n.ts");
50907
50947
  const configContent = `import { createI18n } from 'vue-i18n';
50908
50948
 
50909
50949
  ${options.supportedLocales.map((loc) => `import ${loc}Messages from '../messages/${loc}.json';`).join("\n")}
@@ -50919,7 +50959,7 @@ export const i18n = createI18n({
50919
50959
  messages,
50920
50960
  });
50921
50961
  `;
50922
- await fs7.writeFile(i18nConfigPath, configContent, "utf8");
50962
+ await fs8.writeFile(i18nConfigPath, configContent, "utf8");
50923
50963
  createdFiles.push("src/i18n.ts");
50924
50964
  return {
50925
50965
  createdFiles,
@@ -50938,32 +50978,32 @@ export const i18n = createI18n({
50938
50978
  async writeRuntimeMessages(projectRoot, options) {
50939
50979
  const compiled = this.compileRuntimeMessages(options);
50940
50980
  const writtenFiles = [];
50941
- const outDir = path9.resolve(projectRoot, options.manifest.paths.translations_directory);
50942
- await fs7.mkdir(outDir, { recursive: true });
50981
+ const outDir = path10.resolve(projectRoot, options.manifest.paths.translations_directory);
50982
+ await fs8.mkdir(outDir, { recursive: true });
50943
50983
  for (const [locale, messages] of Object.entries(compiled)) {
50944
- const filePath = path9.resolve(outDir, `${locale}.json`);
50984
+ const filePath = path10.resolve(outDir, `${locale}.json`);
50945
50985
  await writeJsonAtomic(filePath, messages);
50946
- writtenFiles.push(path9.relative(projectRoot, filePath));
50986
+ writtenFiles.push(path10.relative(projectRoot, filePath));
50947
50987
  }
50948
50988
  return writtenFiles;
50949
50989
  }
50950
50990
  };
50951
50991
 
50952
50992
  // ../../packages/framework-adapters/dist/expo/adapter.js
50953
- import fs8 from "fs/promises";
50954
- import path10 from "path";
50993
+ import fs9 from "fs/promises";
50994
+ import path11 from "path";
50955
50995
  var ExpoAdapter = class {
50956
50996
  name = "expo";
50957
50997
  framework = "expo";
50958
50998
  library = "expo-localization";
50959
50999
  async detect(projectRoot) {
50960
- const pkg = await readJsonIfExists(path10.resolve(projectRoot, "package.json"));
51000
+ const pkg = await readJsonIfExists(path11.resolve(projectRoot, "package.json"));
50961
51001
  return Boolean(pkg?.dependencies?.["expo"] || pkg?.dependencies?.["react-native"]);
50962
51002
  }
50963
51003
  async initialize(projectRoot, options) {
50964
51004
  const createdFiles = [];
50965
51005
  const rootDir = projectRoot;
50966
- const i18nConfigPath = path10.resolve(rootDir, "i18n.ts");
51006
+ const i18nConfigPath = path11.resolve(rootDir, "i18n.ts");
50967
51007
  const configContent = `import i18n from 'i18next';
50968
51008
  import { initReactI18next } from 'react-i18next';
50969
51009
  import { getLocales } from 'expo-localization';
@@ -50989,7 +51029,7 @@ i18n
50989
51029
 
50990
51030
  export default i18n;
50991
51031
  `;
50992
- await fs8.writeFile(i18nConfigPath, configContent, "utf8");
51032
+ await fs9.writeFile(i18nConfigPath, configContent, "utf8");
50993
51033
  createdFiles.push("i18n.ts");
50994
51034
  return {
50995
51035
  createdFiles,
@@ -51008,33 +51048,33 @@ export default i18n;
51008
51048
  async writeRuntimeMessages(projectRoot, options) {
51009
51049
  const compiled = this.compileRuntimeMessages(options);
51010
51050
  const writtenFiles = [];
51011
- const outDir = path10.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
51012
- await fs8.mkdir(outDir, { recursive: true });
51051
+ const outDir = path11.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
51052
+ await fs9.mkdir(outDir, { recursive: true });
51013
51053
  for (const [locale, messages] of Object.entries(compiled)) {
51014
- const filePath = path10.resolve(outDir, `${locale}.json`);
51054
+ const filePath = path11.resolve(outDir, `${locale}.json`);
51015
51055
  await writeJsonAtomic(filePath, messages);
51016
- writtenFiles.push(path10.relative(projectRoot, filePath));
51056
+ writtenFiles.push(path11.relative(projectRoot, filePath));
51017
51057
  }
51018
51058
  return writtenFiles;
51019
51059
  }
51020
51060
  };
51021
51061
 
51022
51062
  // ../../packages/framework-adapters/dist/astro/adapter.js
51023
- import fs9 from "fs/promises";
51024
- import path11 from "path";
51063
+ import fs10 from "fs/promises";
51064
+ import path12 from "path";
51025
51065
  var AstroAdapter = class {
51026
51066
  name = "astro";
51027
51067
  framework = "astro";
51028
51068
  library = "astro-i18n";
51029
51069
  async detect(projectRoot) {
51030
- const pkg = await readJsonIfExists(path11.resolve(projectRoot, "package.json"));
51070
+ const pkg = await readJsonIfExists(path12.resolve(projectRoot, "package.json"));
51031
51071
  return Boolean(pkg?.dependencies?.["astro"]);
51032
51072
  }
51033
51073
  async initialize(projectRoot, options) {
51034
51074
  const createdFiles = [];
51035
- const srcDir = path11.resolve(projectRoot, "src", "i18n");
51036
- await fs9.mkdir(srcDir, { recursive: true });
51037
- const utilsPath = path11.resolve(srcDir, "utils.ts");
51075
+ const srcDir = path12.resolve(projectRoot, "src", "i18n");
51076
+ await fs10.mkdir(srcDir, { recursive: true });
51077
+ const utilsPath = path12.resolve(srcDir, "utils.ts");
51038
51078
  const utilsContent = `export const defaultLocale = '${options.sourceLocale}';
51039
51079
  export const locales = ${JSON.stringify(options.supportedLocales)} as const;
51040
51080
 
@@ -51048,7 +51088,7 @@ export async function useTranslations(locale: Locale) {
51048
51088
  };
51049
51089
  }
51050
51090
  `;
51051
- await fs9.writeFile(utilsPath, utilsContent, "utf8");
51091
+ await fs10.writeFile(utilsPath, utilsContent, "utf8");
51052
51092
  createdFiles.push("src/i18n/utils.ts");
51053
51093
  return {
51054
51094
  createdFiles,
@@ -51067,12 +51107,12 @@ export async function useTranslations(locale: Locale) {
51067
51107
  async writeRuntimeMessages(projectRoot, options) {
51068
51108
  const compiled = this.compileRuntimeMessages(options);
51069
51109
  const writtenFiles = [];
51070
- const outDir = path11.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
51071
- await fs9.mkdir(outDir, { recursive: true });
51110
+ const outDir = path12.resolve(projectRoot, options.manifest.paths.translations_directory, "runtime");
51111
+ await fs10.mkdir(outDir, { recursive: true });
51072
51112
  for (const [locale, messages] of Object.entries(compiled)) {
51073
- const filePath = path11.resolve(outDir, `${locale}.json`);
51113
+ const filePath = path12.resolve(outDir, `${locale}.json`);
51074
51114
  await writeJsonAtomic(filePath, messages);
51075
- writtenFiles.push(path11.relative(projectRoot, filePath));
51115
+ writtenFiles.push(path12.relative(projectRoot, filePath));
51076
51116
  }
51077
51117
  return writtenFiles;
51078
51118
  }
@@ -51141,8 +51181,8 @@ async function initCommand(options) {
51141
51181
  }
51142
51182
  };
51143
51183
  await storage.writeManifest(manifest);
51144
- const baseDir = path12.resolve(cwd, manifest.paths.base_directory);
51145
- await fs10.mkdir(baseDir, { recursive: true });
51184
+ const baseDir = path13.resolve(cwd, manifest.paths.base_directory);
51185
+ await fs11.mkdir(baseDir, { recursive: true });
51146
51186
  const existingCanonical = await storage.readCanonicalCatalog(
51147
51187
  manifest.paths.base_directory,
51148
51188
  sourceLocale
@@ -51165,8 +51205,8 @@ async function initCommand(options) {
51165
51205
  },
51166
51206
  manifest.paths.base_directory
51167
51207
  );
51168
- const messagesDir = path12.resolve(cwd, manifest.paths.translations_directory);
51169
- await fs10.mkdir(messagesDir, { recursive: true });
51208
+ const messagesDir = path13.resolve(cwd, manifest.paths.translations_directory);
51209
+ await fs11.mkdir(messagesDir, { recursive: true });
51170
51210
  for (const loc of supportedLocales) {
51171
51211
  const existingLocCatalog = await storage.readLocaleCatalog(loc, manifest.paths.translations_directory);
51172
51212
  await storage.writeLocaleCatalog(loc, existingLocCatalog, manifest.paths.translations_directory);
@@ -51198,8 +51238,8 @@ async function initCommand(options) {
51198
51238
  }
51199
51239
 
51200
51240
  // src/commands/extract.ts
51201
- import fs11 from "fs/promises";
51202
- import path13 from "path";
51241
+ import fs12 from "fs/promises";
51242
+ import path14 from "path";
51203
51243
  import React2 from "react";
51204
51244
  import { render as render2 } from "ink";
51205
51245
 
@@ -51284,8 +51324,8 @@ async function extractCommand(options) {
51284
51324
  const allExtractedStrings = [];
51285
51325
  const modifiedFiles = [];
51286
51326
  for (const relPath of filePaths) {
51287
- const fullPath = path13.resolve(cwd, relPath);
51288
- const code = await fs11.readFile(fullPath, "utf8");
51327
+ const fullPath = path14.resolve(cwd, relPath);
51328
+ const code = await fs12.readFile(fullPath, "utf8");
51289
51329
  if (shouldApplyCodeTransform && !isDryRun) {
51290
51330
  const transformRes = transformSourceFile({
51291
51331
  filePath: relPath,
@@ -51294,7 +51334,7 @@ async function extractCommand(options) {
51294
51334
  framework: manifest.framework.name
51295
51335
  });
51296
51336
  if (transformRes.changed) {
51297
- await fs11.writeFile(fullPath, transformRes.transformedCode, "utf8");
51337
+ await fs12.writeFile(fullPath, transformRes.transformedCode, "utf8");
51298
51338
  modifiedFiles.push(relPath);
51299
51339
  }
51300
51340
  }
@@ -52284,6 +52324,520 @@ async function entrySetCommand(locale, key, translatedValue, options) {
52284
52324
  printer.log(` "${translatedValue}" (version: ${canonicalEntry.key_version})`);
52285
52325
  }
52286
52326
 
52327
+ // src/commands/link.ts
52328
+ import path15 from "path";
52329
+ import fs13 from "fs/promises";
52330
+ async function linkCommand(options) {
52331
+ const cwd = process.cwd();
52332
+ const printer = new Printer(options.json);
52333
+ const storage = new CatalogStorage(cwd);
52334
+ const manifest = await storage.readManifest();
52335
+ if (!manifest) {
52336
+ printer.error('No localization.json found in current directory. Run "shallok init" first.');
52337
+ process.exit(1);
52338
+ }
52339
+ const dashboardUrl = (options.url || process.env.SHALLOK_DASHBOARD_URL || "https://dash.shallok.com").replace(/\/+$/, "");
52340
+ let token = options.token || process.env.SHALLOK_API_TOKEN;
52341
+ if (!token) {
52342
+ for (const envFile of [".env.local", ".env"]) {
52343
+ try {
52344
+ const envContent = await fs13.readFile(path15.join(cwd, envFile), "utf-8");
52345
+ const match = envContent.match(/^SHALLOK_API_TOKEN\s*=\s*([^\s#]+)/m);
52346
+ if (match && match[1]) {
52347
+ token = match[1].trim();
52348
+ break;
52349
+ }
52350
+ } catch {
52351
+ }
52352
+ }
52353
+ }
52354
+ if (!token) {
52355
+ printer.error(
52356
+ `Shallok API Access Token required.
52357
+ Generate your token at: ${dashboardUrl}/mcp
52358
+ Then run:
52359
+ npx shallok link --project <project-id> --token <shk_live_...>`
52360
+ );
52361
+ process.exit(1);
52362
+ }
52363
+ let projectId = options.project || manifest.cloud?.project_id;
52364
+ if (!projectId) {
52365
+ try {
52366
+ const pkg = JSON.parse(await fs13.readFile(path15.join(cwd, "package.json"), "utf-8"));
52367
+ if (pkg.name) {
52368
+ projectId = pkg.name.toLowerCase().replace(/[^a-z0-9_-]/g, "-").replace(/^@.*\//, "");
52369
+ }
52370
+ } catch {
52371
+ }
52372
+ }
52373
+ if (!projectId) {
52374
+ projectId = path15.basename(cwd).toLowerCase().replace(/[^a-z0-9_-]/g, "-");
52375
+ }
52376
+ printer.log(`Connecting project "${projectId}" to Shallok Dashboard (${dashboardUrl})...`);
52377
+ let workspaceSlug = options.workspace || manifest.cloud?.workspace || "";
52378
+ try {
52379
+ const res = await fetch(`${dashboardUrl}/api/subdomain/current`, {
52380
+ headers: {
52381
+ Authorization: `Bearer ${token}`
52382
+ }
52383
+ });
52384
+ if (res.status === 401) {
52385
+ printer.error(`Invalid or expired API token. Please generate a new token at ${dashboardUrl}/mcp`);
52386
+ process.exit(1);
52387
+ }
52388
+ if (res.ok) {
52389
+ const subData = await res.json().catch(() => ({}));
52390
+ if (subData?.workspace?.slug) {
52391
+ workspaceSlug = subData.workspace.slug;
52392
+ }
52393
+ }
52394
+ } catch (err) {
52395
+ if (!workspaceSlug) {
52396
+ workspaceSlug = "app";
52397
+ }
52398
+ }
52399
+ const cdnBase = workspaceSlug ? `https://${workspaceSlug}.shallok.com/${projectId}` : `${dashboardUrl}/cdn/${projectId}`;
52400
+ manifest.cloud = {
52401
+ project_id: projectId,
52402
+ workspace: workspaceSlug,
52403
+ dashboard_url: dashboardUrl,
52404
+ cdn_url: cdnBase,
52405
+ auto_publish: true
52406
+ };
52407
+ await storage.writeManifest(manifest);
52408
+ try {
52409
+ const envLocalPath = path15.join(cwd, ".env.local");
52410
+ let envContent = "";
52411
+ try {
52412
+ envContent = await fs13.readFile(envLocalPath, "utf-8");
52413
+ } catch {
52414
+ }
52415
+ if (!envContent.includes("SHALLOK_API_TOKEN=")) {
52416
+ const newline = envContent.length > 0 && !envContent.endsWith("\n") ? "\n" : "";
52417
+ await fs13.writeFile(
52418
+ envLocalPath,
52419
+ `${envContent}${newline}# Shallok Cloud API Token
52420
+ SHALLOK_API_TOKEN=${token}
52421
+ `,
52422
+ "utf-8"
52423
+ );
52424
+ }
52425
+ } catch {
52426
+ }
52427
+ let mcpConfigured = false;
52428
+ try {
52429
+ const cursorDir = path15.join(cwd, ".cursor");
52430
+ await fs13.mkdir(cursorDir, { recursive: true });
52431
+ const cursorMcpPath = path15.join(cursorDir, "mcp.json");
52432
+ let existingMcp = { mcpServers: {} };
52433
+ try {
52434
+ existingMcp = JSON.parse(await fs13.readFile(cursorMcpPath, "utf-8"));
52435
+ if (!existingMcp.mcpServers) existingMcp.mcpServers = {};
52436
+ } catch {
52437
+ }
52438
+ existingMcp.mcpServers["shallok"] = {
52439
+ command: "npx",
52440
+ args: ["shallok", "mcp"]
52441
+ };
52442
+ await fs13.writeFile(cursorMcpPath, JSON.stringify(existingMcp, null, 2), "utf-8");
52443
+ mcpConfigured = true;
52444
+ } catch {
52445
+ }
52446
+ if (options.json) {
52447
+ printer.json({
52448
+ success: true,
52449
+ projectId,
52450
+ workspace: workspaceSlug,
52451
+ dashboardUrl,
52452
+ cdnBaseUrl: cdnBase,
52453
+ mcpConfigured,
52454
+ manifestCloud: manifest.cloud
52455
+ });
52456
+ return;
52457
+ }
52458
+ printer.header("Shallok \u2022 Project Successfully Connected to Cloud");
52459
+ printer.success(`Linked project ID: ${projectId}`);
52460
+ if (workspaceSlug) {
52461
+ printer.info(`Workspace subdomain: ${workspaceSlug}.shallok.com`);
52462
+ }
52463
+ printer.info(`Live CDN Base: ${cdnBase}`);
52464
+ if (mcpConfigured) {
52465
+ printer.success(`Configured Shallok MCP server in .cursor/mcp.json`);
52466
+ }
52467
+ printer.log("");
52468
+ printer.log("Next Steps:");
52469
+ printer.log(" 1. Upload your current translations to the Global Edge CDN:");
52470
+ printer.log(" npx shallok push");
52471
+ printer.log(" 2. Ask your AI coding agent (Cursor, Claude, Antigravity) to translate keys:");
52472
+ printer.log(' "Add Kannada & Hindi to this app"');
52473
+ }
52474
+
52475
+ // src/commands/push.ts
52476
+ import path16 from "path";
52477
+ import fs14 from "fs/promises";
52478
+ async function pushCommand(options) {
52479
+ const cwd = process.cwd();
52480
+ const printer = new Printer(options.json);
52481
+ const storage = new CatalogStorage(cwd);
52482
+ const manifest = await storage.readManifest();
52483
+ if (!manifest) {
52484
+ printer.error('No localization.json found. Run "shallok init" first.');
52485
+ process.exit(1);
52486
+ }
52487
+ const cloud = manifest.cloud;
52488
+ const projectId = options.project || cloud?.project_id;
52489
+ const dashboardUrl = (options.url || cloud?.dashboard_url || process.env.SHALLOK_DASHBOARD_URL || "https://dash.shallok.com").replace(/\/+$/, "");
52490
+ if (!projectId) {
52491
+ printer.error(
52492
+ 'Project is not yet connected to Shallok Cloud.\nRun "shallok link" first to connect this repository to your Shallok Dashboard.'
52493
+ );
52494
+ process.exit(1);
52495
+ }
52496
+ let token = options.token || process.env.SHALLOK_API_TOKEN;
52497
+ if (!token) {
52498
+ for (const envFile of [".env.local", ".env"]) {
52499
+ try {
52500
+ const envContent = await fs14.readFile(path16.join(cwd, envFile), "utf-8");
52501
+ const match = envContent.match(/^SHALLOK_API_TOKEN\s*=\s*([^\s#]+)/m);
52502
+ if (match && match[1]) {
52503
+ token = match[1].trim();
52504
+ break;
52505
+ }
52506
+ } catch {
52507
+ }
52508
+ }
52509
+ }
52510
+ if (!token) {
52511
+ printer.error(
52512
+ `SHALLOK_API_TOKEN is missing.
52513
+ Provide via --token, set SHALLOK_API_TOKEN in .env.local, or run "shallok link".`
52514
+ );
52515
+ process.exit(1);
52516
+ }
52517
+ printer.log(`Preparing translation files for project "${projectId}"...`);
52518
+ const runtimeDir = path16.join(cwd, manifest.paths.translations_directory, "runtime");
52519
+ let runtimeExists = false;
52520
+ try {
52521
+ const entries = await fs14.readdir(runtimeDir);
52522
+ runtimeExists = entries.some((f) => f.endsWith(".json"));
52523
+ } catch {
52524
+ }
52525
+ if (!runtimeExists) {
52526
+ printer.log('Runtime bundles not found; compiling them via "shallok build"...');
52527
+ await buildCommand({ json: false });
52528
+ }
52529
+ const filesPayload = [];
52530
+ try {
52531
+ const runtimeFiles = await fs14.readdir(runtimeDir);
52532
+ for (const file of runtimeFiles) {
52533
+ if (!file.endsWith(".json")) continue;
52534
+ const locale = file.replace(/\.json$/i, "").toLowerCase();
52535
+ const content = JSON.parse(await fs14.readFile(path16.join(runtimeDir, file), "utf-8"));
52536
+ filesPayload.push({
52537
+ locale,
52538
+ content,
52539
+ version: String(manifest.localization_version || "1.0.0")
52540
+ });
52541
+ }
52542
+ } catch (err) {
52543
+ printer.error(`Failed to read runtime message files: ${err.message}`);
52544
+ process.exit(1);
52545
+ }
52546
+ if (filesPayload.length === 0) {
52547
+ printer.error('No translation files found to upload. Run "shallok extract" and "shallok translate" first.');
52548
+ process.exit(1);
52549
+ }
52550
+ printer.log(`Uploading ${filesPayload.length} locale bundles to Shallok Cloud (${dashboardUrl})...`);
52551
+ try {
52552
+ const syncUrl = `${dashboardUrl}/api/projects/${encodeURIComponent(projectId)}/sync`;
52553
+ const res = await fetch(syncUrl, {
52554
+ method: "POST",
52555
+ headers: {
52556
+ "Content-Type": "application/json",
52557
+ Authorization: `Bearer ${token}`
52558
+ },
52559
+ body: JSON.stringify({
52560
+ projectId,
52561
+ manifest,
52562
+ version: String(manifest.localization_version || "1.0.0"),
52563
+ files: filesPayload,
52564
+ uploadedVia: "cli"
52565
+ })
52566
+ });
52567
+ const result = await res.json().catch(() => ({}));
52568
+ if (!res.ok) {
52569
+ printer.error(`Cloud sync failed (${res.status}): ${result.error || res.statusText}`);
52570
+ process.exit(1);
52571
+ }
52572
+ if (options.json) {
52573
+ printer.json({
52574
+ success: true,
52575
+ projectId: result.projectId,
52576
+ workspace: result.workspace,
52577
+ syncedLocales: result.syncedLocales,
52578
+ totalKeys: result.totalKeys,
52579
+ cdnUrls: result.cdnUrls,
52580
+ manifestUrl: result.manifestUrl
52581
+ });
52582
+ return;
52583
+ }
52584
+ printer.header("Shallok \u2022 Cloud Sync Succeeded!");
52585
+ printer.success(`Published ${result.filesCount || filesPayload.length} locales (${result.totalKeys || 0} keys)`);
52586
+ printer.info(`Project: ${result.projectId}`);
52587
+ if (result.workspace) {
52588
+ printer.info(`Tenant: ${result.workspace}.shallok.com`);
52589
+ }
52590
+ printer.log("");
52591
+ printer.log("Global Edge CDN Endpoints:");
52592
+ if (result.cdnUrls) {
52593
+ for (const [loc, url] of Object.entries(result.cdnUrls)) {
52594
+ printer.log(` \u2714 [${loc.toUpperCase()}] ${url}`);
52595
+ }
52596
+ }
52597
+ if (result.manifestUrl) {
52598
+ printer.log(` \u2714 [MANIFEST] ${result.manifestUrl}`);
52599
+ }
52600
+ } catch (err) {
52601
+ printer.error(`Network error during cloud sync: ${err.message}`);
52602
+ process.exit(1);
52603
+ }
52604
+ }
52605
+
52606
+ // src/commands/mcp.ts
52607
+ import path17 from "path";
52608
+ import fs15 from "fs/promises";
52609
+ import readline from "readline";
52610
+ var LOCAL_MCP_TOOLS = [
52611
+ {
52612
+ name: "shallok_sync_project",
52613
+ description: "Synchronize local localization files and compiled translations to Shallok Cloud and Global Edge CDN.",
52614
+ inputSchema: {
52615
+ type: "object",
52616
+ properties: {
52617
+ forceBuild: {
52618
+ type: "boolean",
52619
+ description: "Rebuild runtime bundles before syncing. Default: true"
52620
+ }
52621
+ }
52622
+ }
52623
+ },
52624
+ {
52625
+ name: "shallok_get_cdn_url",
52626
+ description: "Get live Global Edge CDN URL for a specific locale from project cloud configuration.",
52627
+ inputSchema: {
52628
+ type: "object",
52629
+ required: ["locale"],
52630
+ properties: {
52631
+ locale: {
52632
+ type: "string",
52633
+ description: 'Locale code (e.g. "en", "kn", "hi", "es").'
52634
+ }
52635
+ }
52636
+ }
52637
+ },
52638
+ {
52639
+ name: "shallok_get_project_status",
52640
+ description: "Check local project localization status, supported locales, and cloud connection details.",
52641
+ inputSchema: {
52642
+ type: "object",
52643
+ properties: {}
52644
+ }
52645
+ }
52646
+ ];
52647
+ async function mcpCommand() {
52648
+ const cwd = process.cwd();
52649
+ const storage = new CatalogStorage(cwd);
52650
+ const rl = readline.createInterface({
52651
+ input: process.stdin,
52652
+ output: process.stdout,
52653
+ terminal: false
52654
+ });
52655
+ const sendResponse = (resp) => {
52656
+ process.stdout.write(JSON.stringify(resp) + "\n");
52657
+ };
52658
+ rl.on("line", async (line) => {
52659
+ const trimmed = line.trim();
52660
+ if (!trimmed) return;
52661
+ let req;
52662
+ try {
52663
+ req = JSON.parse(trimmed);
52664
+ } catch (err) {
52665
+ sendResponse({
52666
+ jsonrpc: "2.0",
52667
+ id: null,
52668
+ error: { code: -32700, message: `Parse error: ${err.message}` }
52669
+ });
52670
+ return;
52671
+ }
52672
+ const { id, method, params } = req;
52673
+ if (method === "initialize") {
52674
+ sendResponse({
52675
+ jsonrpc: "2.0",
52676
+ id,
52677
+ result: {
52678
+ protocolVersion: "2024-11-05",
52679
+ capabilities: { tools: { listChanged: false } },
52680
+ serverInfo: { name: "shallok-local-mcp", version: "1.0.0" }
52681
+ }
52682
+ });
52683
+ return;
52684
+ }
52685
+ if (method === "notifications/initialized") {
52686
+ return;
52687
+ }
52688
+ if (method === "tools/list") {
52689
+ sendResponse({
52690
+ jsonrpc: "2.0",
52691
+ id,
52692
+ result: { tools: LOCAL_MCP_TOOLS }
52693
+ });
52694
+ return;
52695
+ }
52696
+ if (method === "tools/call") {
52697
+ const toolName = params?.name;
52698
+ const toolArgs = params?.arguments || {};
52699
+ try {
52700
+ const manifest = await storage.readManifest();
52701
+ if (!manifest) {
52702
+ throw new Error("No localization.json found in current directory.");
52703
+ }
52704
+ switch (toolName) {
52705
+ case "shallok_get_project_status": {
52706
+ sendResponse({
52707
+ jsonrpc: "2.0",
52708
+ id,
52709
+ result: {
52710
+ content: [
52711
+ {
52712
+ type: "text",
52713
+ text: JSON.stringify(
52714
+ {
52715
+ sourceLocale: manifest.source_locale,
52716
+ supportedLocales: manifest.supported_locales,
52717
+ framework: manifest.framework,
52718
+ cloud: manifest.cloud || 'Not connected (run "shallok link")'
52719
+ },
52720
+ null,
52721
+ 2
52722
+ )
52723
+ }
52724
+ ]
52725
+ }
52726
+ });
52727
+ return;
52728
+ }
52729
+ case "shallok_get_cdn_url": {
52730
+ const loc = (toolArgs.locale || "en").toLowerCase();
52731
+ const cloud = manifest.cloud;
52732
+ if (!cloud?.project_id) {
52733
+ throw new Error('Project not linked to Shallok Cloud. Run "shallok link" first.');
52734
+ }
52735
+ const cdnUrl = cloud.cdn_url ? `${cloud.cdn_url}/${loc}.json` : `https://${cloud.workspace || "app"}.shallok.com/${cloud.project_id}/${loc}.json`;
52736
+ sendResponse({
52737
+ jsonrpc: "2.0",
52738
+ id,
52739
+ result: {
52740
+ content: [
52741
+ {
52742
+ type: "text",
52743
+ text: JSON.stringify({ locale: loc, cdnUrl, projectId: cloud.project_id }, null, 2)
52744
+ }
52745
+ ]
52746
+ }
52747
+ });
52748
+ return;
52749
+ }
52750
+ case "shallok_sync_project": {
52751
+ const cloud = manifest.cloud;
52752
+ if (!cloud?.project_id) {
52753
+ throw new Error('Project not connected to Shallok Cloud. Run "shallok link --token <shk_live_...>" first.');
52754
+ }
52755
+ let token = process.env.SHALLOK_API_TOKEN;
52756
+ if (!token) {
52757
+ for (const envFile of [".env.local", ".env"]) {
52758
+ try {
52759
+ const envContent = await fs15.readFile(path17.join(cwd, envFile), "utf-8");
52760
+ const match = envContent.match(/^SHALLOK_API_TOKEN\s*=\s*([^\s#]+)/m);
52761
+ if (match && match[1]) {
52762
+ token = match[1].trim();
52763
+ break;
52764
+ }
52765
+ } catch {
52766
+ }
52767
+ }
52768
+ }
52769
+ if (!token) {
52770
+ throw new Error("SHALLOK_API_TOKEN not found in environment or .env.local.");
52771
+ }
52772
+ await buildCommand({ json: true });
52773
+ const runtimeDir = path17.join(cwd, manifest.paths.translations_directory, "runtime");
52774
+ const runtimeFiles = await fs15.readdir(runtimeDir);
52775
+ const filesPayload = [];
52776
+ for (const file of runtimeFiles) {
52777
+ if (!file.endsWith(".json")) continue;
52778
+ const locale = file.replace(/\.json$/i, "").toLowerCase();
52779
+ const content = JSON.parse(await fs15.readFile(path17.join(runtimeDir, file), "utf-8"));
52780
+ filesPayload.push({ locale, content });
52781
+ }
52782
+ const dashboardUrl = (cloud.dashboard_url || "https://dash.shallok.com").replace(/\/+$/, "");
52783
+ const syncUrl = `${dashboardUrl}/api/projects/${encodeURIComponent(cloud.project_id)}/sync`;
52784
+ const res = await fetch(syncUrl, {
52785
+ method: "POST",
52786
+ headers: {
52787
+ "Content-Type": "application/json",
52788
+ Authorization: `Bearer ${token}`
52789
+ },
52790
+ body: JSON.stringify({
52791
+ projectId: cloud.project_id,
52792
+ manifest,
52793
+ version: String(manifest.localization_version || "1.0.0"),
52794
+ files: filesPayload,
52795
+ uploadedVia: "mcp"
52796
+ })
52797
+ });
52798
+ const result = await res.json().catch(() => ({}));
52799
+ if (!res.ok) {
52800
+ throw new Error(`Sync failed: ${result.error || res.statusText}`);
52801
+ }
52802
+ sendResponse({
52803
+ jsonrpc: "2.0",
52804
+ id,
52805
+ result: {
52806
+ content: [
52807
+ {
52808
+ type: "text",
52809
+ text: JSON.stringify(result, null, 2)
52810
+ }
52811
+ ]
52812
+ }
52813
+ });
52814
+ return;
52815
+ }
52816
+ default:
52817
+ sendResponse({
52818
+ jsonrpc: "2.0",
52819
+ id,
52820
+ error: { code: -32601, message: `Tool not found: ${toolName}` }
52821
+ });
52822
+ return;
52823
+ }
52824
+ } catch (err) {
52825
+ sendResponse({
52826
+ jsonrpc: "2.0",
52827
+ id,
52828
+ error: { code: -32603, message: err.message }
52829
+ });
52830
+ return;
52831
+ }
52832
+ }
52833
+ sendResponse({
52834
+ jsonrpc: "2.0",
52835
+ id,
52836
+ error: { code: -32601, message: `Method not found: ${method}` }
52837
+ });
52838
+ });
52839
+ }
52840
+
52287
52841
  // src/index.ts
52288
52842
  var program = new Command();
52289
52843
  program.name("shallok").description("Shallok: AI-Powered, Versioned Localization Tool").version(CLI_VERSION).option("--json", "Output machine-readable JSON for AI agent orchestration");
@@ -52351,6 +52905,17 @@ program.command("sync").description("Full localization workflow: extract, transl
52351
52905
  const isJson = options.json || program.opts().json;
52352
52906
  await syncCommand({ ...options, json: isJson });
52353
52907
  });
52908
+ program.command("link").description("Link project with Shallok Cloud Dashboard and configure MCP").option("--project <id>", "Project ID").option("--token <token>", "Shallok API Access Token").option("--workspace <slug>", "Workspace subdomain slug").option("--url <url>", "Shallok Dashboard URL").option("--json", "Output machine-readable JSON").action(async (options) => {
52909
+ const isJson = options.json || program.opts().json;
52910
+ await linkCommand({ ...options, json: isJson });
52911
+ });
52912
+ program.command("push").description("Upload compiled translation bundles to Shallok Cloud and Global Edge CDN").option("--project <id>", "Project ID override").option("--token <token>", "API Token override").option("--url <url>", "Dashboard URL override").option("--json", "Output machine-readable JSON").action(async (options) => {
52913
+ const isJson = options.json || program.opts().json;
52914
+ await pushCommand({ ...options, json: isJson });
52915
+ });
52916
+ program.command("mcp").description("Start local stdio Model Context Protocol (MCP) server for Cursor / Claude / Antigravity").action(async () => {
52917
+ await mcpCommand();
52918
+ });
52354
52919
  program.parseAsync(process.argv).catch((err) => {
52355
52920
  console.error(err);
52356
52921
  process.exit(1);