drizzle-kit 0.16.9-19c6550 → 0.16.9-1e8174f

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.
Files changed (3) hide show
  1. package/index.js +2908 -216
  2. package/package.json +7 -4
  3. package/utils.js +233 -15
package/index.js CHANGED
@@ -613,7 +613,7 @@ var require_command = __commonJS({
613
613
  "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js"(exports) {
614
614
  var EventEmitter = require("events").EventEmitter;
615
615
  var childProcess = require("child_process");
616
- var path4 = require("path");
616
+ var path2 = require("path");
617
617
  var fs7 = require("fs");
618
618
  var process3 = require("process");
619
619
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -1053,10 +1053,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1053
1053
  let launchWithNode = false;
1054
1054
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1055
1055
  function findFile(baseDir, baseName) {
1056
- const localBin = path4.resolve(baseDir, baseName);
1056
+ const localBin = path2.resolve(baseDir, baseName);
1057
1057
  if (fs7.existsSync(localBin))
1058
1058
  return localBin;
1059
- if (sourceExt.includes(path4.extname(baseName)))
1059
+ if (sourceExt.includes(path2.extname(baseName)))
1060
1060
  return void 0;
1061
1061
  const foundExt = sourceExt.find((ext) => fs7.existsSync(`${localBin}${ext}`));
1062
1062
  if (foundExt)
@@ -1074,19 +1074,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
1074
1074
  } catch (err2) {
1075
1075
  resolvedScriptPath = this._scriptPath;
1076
1076
  }
1077
- executableDir = path4.resolve(path4.dirname(resolvedScriptPath), executableDir);
1077
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
1078
1078
  }
1079
1079
  if (executableDir) {
1080
1080
  let localFile = findFile(executableDir, executableFile);
1081
1081
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1082
- const legacyName = path4.basename(this._scriptPath, path4.extname(this._scriptPath));
1082
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
1083
1083
  if (legacyName !== this._name) {
1084
1084
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1085
1085
  }
1086
1086
  }
1087
1087
  executableFile = localFile || executableFile;
1088
1088
  }
1089
- launchWithNode = sourceExt.includes(path4.extname(executableFile));
1089
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
1090
1090
  let proc;
1091
1091
  if (process3.platform !== "win32") {
1092
1092
  if (launchWithNode) {
@@ -1658,13 +1658,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1658
1658
  return this;
1659
1659
  }
1660
1660
  nameFromFilename(filename) {
1661
- this._name = path4.basename(filename, path4.extname(filename));
1661
+ this._name = path2.basename(filename, path2.extname(filename));
1662
1662
  return this;
1663
1663
  }
1664
- executableDir(path5) {
1665
- if (path5 === void 0)
1664
+ executableDir(path3) {
1665
+ if (path3 === void 0)
1666
1666
  return this._executableDir;
1667
- this._executableDir = path5;
1667
+ this._executableDir = path3;
1668
1668
  return this;
1669
1669
  }
1670
1670
  helpInformation(contextOptions) {
@@ -2252,8 +2252,8 @@ var init_lib = __esm({
2252
2252
  };
2253
2253
  overrideErrorMap = errorMap;
2254
2254
  makeIssue = (params) => {
2255
- const { data, path: path4, errorMaps, issueData } = params;
2256
- const fullPath = [...path4, ...issueData.path || []];
2255
+ const { data, path: path2, errorMaps, issueData } = params;
2256
+ const fullPath = [...path2, ...issueData.path || []];
2257
2257
  const fullIssue = {
2258
2258
  ...issueData,
2259
2259
  path: fullPath
@@ -2335,10 +2335,10 @@ var init_lib = __esm({
2335
2335
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
2336
2336
  })(errorUtil || (errorUtil = {}));
2337
2337
  ParseInputLazyPath = class {
2338
- constructor(parent, value, path4, key) {
2338
+ constructor(parent, value, path2, key) {
2339
2339
  this.parent = parent;
2340
2340
  this.data = value;
2341
- this._path = path4;
2341
+ this._path = path2;
2342
2342
  this._key = key;
2343
2343
  }
2344
2344
  get path() {
@@ -6338,7 +6338,8 @@ var init_mysqlSchema = __esm({
6338
6338
  primaryKey: booleanType(),
6339
6339
  notNull: booleanType(),
6340
6340
  autoincrement: booleanType().optional(),
6341
- default: anyType().optional()
6341
+ default: anyType().optional(),
6342
+ onUpdate: anyType().optional()
6342
6343
  }).strict();
6343
6344
  tableV3 = objectType({
6344
6345
  name: stringType(),
@@ -6888,7 +6889,7 @@ var init_sqliteSchema = __esm({
6888
6889
  })
6889
6890
  );
6890
6891
  return {
6891
- version: json.version,
6892
+ version: "5",
6892
6893
  dialect: json.dialect,
6893
6894
  tables: mappedTables,
6894
6895
  enums: json.enums
@@ -9851,7 +9852,7 @@ var require_get = __commonJS({
9851
9852
  return lastId;
9852
9853
  },
9853
9854
  delete: function(id) {
9854
- var index4 = 0, set = map, i, args = cache[id], length = args.length, path4 = [];
9855
+ var index4 = 0, set = map, i, args = cache[id], length = args.length, path2 = [];
9855
9856
  if (length === 0) {
9856
9857
  delete set[length];
9857
9858
  } else if (set = set[length]) {
@@ -9860,7 +9861,7 @@ var require_get = __commonJS({
9860
9861
  if (i === -1) {
9861
9862
  return;
9862
9863
  }
9863
- path4.push(set, i);
9864
+ path2.push(set, i);
9864
9865
  set = set[1][i];
9865
9866
  ++index4;
9866
9867
  }
@@ -9871,9 +9872,9 @@ var require_get = __commonJS({
9871
9872
  id = set[1][i];
9872
9873
  set[0].splice(i, 1);
9873
9874
  set[1].splice(i, 1);
9874
- while (!set[0].length && path4.length) {
9875
- i = path4.pop();
9876
- set = path4.pop();
9875
+ while (!set[0].length && path2.length) {
9876
+ i = path2.pop();
9877
+ set = path2.pop();
9877
9878
  set[0].splice(i, 1);
9878
9879
  set[1].splice(i, 1);
9879
9880
  }
@@ -9965,13 +9966,13 @@ var require_get_fixed = __commonJS({
9965
9966
  return lastId;
9966
9967
  },
9967
9968
  delete: function(id) {
9968
- var index4 = 0, set = map, i, path4 = [], args = cache[id];
9969
+ var index4 = 0, set = map, i, path2 = [], args = cache[id];
9969
9970
  while (index4 < length - 1) {
9970
9971
  i = indexOf.call(set[0], args[index4]);
9971
9972
  if (i === -1) {
9972
9973
  return;
9973
9974
  }
9974
- path4.push(set, i);
9975
+ path2.push(set, i);
9975
9976
  set = set[1][i];
9976
9977
  ++index4;
9977
9978
  }
@@ -9982,9 +9983,9 @@ var require_get_fixed = __commonJS({
9982
9983
  id = set[1][i];
9983
9984
  set[0].splice(i, 1);
9984
9985
  set[1].splice(i, 1);
9985
- while (!set[0].length && path4.length) {
9986
- i = path4.pop();
9987
- set = path4.pop();
9986
+ while (!set[0].length && path2.length) {
9987
+ i = path2.pop();
9988
+ set = path2.pop();
9988
9989
  set[0].splice(i, 1);
9989
9990
  set[1].splice(i, 1);
9990
9991
  }
@@ -13204,6 +13205,32 @@ var init_jsonDiffer = __esm({
13204
13205
  return { ...others, notNull: { type: "deleted", value: it.notNull__deleted } };
13205
13206
  }
13206
13207
  return it;
13208
+ }).map((it) => {
13209
+ if ("onUpdate" in it) {
13210
+ return { ...it, onUpdate: { type: "changed", old: it.onUpdate.__old, new: it.onUpdate.__new } };
13211
+ }
13212
+ if ("onUpdate__added" in it) {
13213
+ const { onUpdate__added, ...others } = it;
13214
+ return { ...others, onUpdate: { type: "added", value: it.onUpdate__added } };
13215
+ }
13216
+ if ("onUpdate__deleted" in it) {
13217
+ const { onUpdate__deleted, ...others } = it;
13218
+ return { ...others, onUpdate: { type: "deleted", value: it.onUpdate__deleted } };
13219
+ }
13220
+ return it;
13221
+ }).map((it) => {
13222
+ if ("autoincrement" in it) {
13223
+ return { ...it, autoincrement: { type: "changed", old: it.autoincrement.__old, new: it.autoincrement.__new } };
13224
+ }
13225
+ if ("autoincrement__added" in it) {
13226
+ const { autoincrement__added, ...others } = it;
13227
+ return { ...others, autoincrement: { type: "added", value: it.autoincrement__added } };
13228
+ }
13229
+ if ("autoincrement__deleted" in it) {
13230
+ const { autoincrement__deleted, ...others } = it;
13231
+ return { ...others, autoincrement: { type: "deleted", value: it.autoincrement__deleted } };
13232
+ }
13233
+ return it;
13207
13234
  });
13208
13235
  return result[0];
13209
13236
  };
@@ -13211,7 +13238,7 @@ var init_jsonDiffer = __esm({
13211
13238
  });
13212
13239
 
13213
13240
  // src/sqlgenerator.ts
13214
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, DropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, convertors, fromJson;
13241
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, DropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, MySqlAlterTableAlterColumnSetDefaultConvertor, MySqlAlterTableAlterColumnDropDefaultConvertor, MySqlModifyColumn, SqliteAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, MySqlDropIndexConvertor, convertors, fromJson;
13215
13242
  var init_sqlgenerator = __esm({
13216
13243
  "src/sqlgenerator.ts"() {
13217
13244
  init_mysqlSchema();
@@ -13293,8 +13320,9 @@ var init_sqlgenerator = __esm({
13293
13320
  const primaryKeyStatement = column6.primaryKey ? "PRIMARY KEY" : "";
13294
13321
  const notNullStatement = column6.notNull ? "NOT NULL" : "";
13295
13322
  const defaultStatement = column6.default !== void 0 ? `DEFAULT ${column6.default}` : "";
13323
+ const onUpdateStatement = column6.onUpdate ? `ON UPDATE CURRENT_TIMESTAMP` : "";
13296
13324
  const autoincrementStatement = column6.autoincrement ? "AUTO_INCREMENT" : "";
13297
- statement += " " + `\`${column6.name}\` ${column6.type} ${autoincrementStatement} ${primaryKeyStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim();
13325
+ statement += " " + `\`${column6.name}\` ${column6.type} ${autoincrementStatement} ${primaryKeyStatement} ${notNullStatement} ${defaultStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
13298
13326
  statement += (i === columns.length - 1 ? "" : ",") + "\n";
13299
13327
  }
13300
13328
  statement += `);`;
@@ -13578,6 +13606,82 @@ var init_sqlgenerator = __esm({
13578
13606
  return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
13579
13607
  }
13580
13608
  };
13609
+ MySqlAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
13610
+ can(statement, dialect6) {
13611
+ return statement.type === "alter_table_alter_column_set_default" && dialect6 === "mysql";
13612
+ }
13613
+ convert(statement) {
13614
+ const { tableName, columnName } = statement;
13615
+ return `ALTER TABLE ${tableName} ALTER COLUMN \`${columnName}\` SET DEFAULT ${statement.newDefaultValue};`;
13616
+ }
13617
+ };
13618
+ MySqlAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
13619
+ can(statement, dialect6) {
13620
+ return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "mysql";
13621
+ }
13622
+ convert(statement) {
13623
+ const { tableName, columnName } = statement;
13624
+ return `ALTER TABLE ${tableName} ALTER COLUMN \`${columnName}\` DROP DEFAULT;`;
13625
+ }
13626
+ };
13627
+ MySqlModifyColumn = class extends Convertor {
13628
+ can(statement, dialect6) {
13629
+ return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement") && dialect6 === "mysql";
13630
+ }
13631
+ convert(statement) {
13632
+ const { tableName, columnName } = statement;
13633
+ let columnType = ``;
13634
+ let columnDefault = "";
13635
+ let columnNotNull = "";
13636
+ let columnOnUpdate = "";
13637
+ let columnAutoincrement = "";
13638
+ if (statement.type === "alter_table_alter_column_drop_notnull") {
13639
+ columnType = ` ${statement.newDataType}`;
13640
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13641
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13642
+ columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
13643
+ columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
13644
+ } else if (statement.type === "alter_table_alter_column_set_notnull") {
13645
+ columnNotNull = ` NOT NULL`;
13646
+ columnType = ` ${statement.newDataType}`;
13647
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13648
+ columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
13649
+ columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
13650
+ } else if (statement.type === "alter_table_alter_column_drop_on_update") {
13651
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13652
+ columnType = ` ${statement.newDataType}`;
13653
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13654
+ columnOnUpdate = "";
13655
+ columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
13656
+ } else if (statement.type === "alter_table_alter_column_set_on_update") {
13657
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13658
+ columnOnUpdate = ` ON UPDATE CURRENT_TIMESTAMP`;
13659
+ columnType = ` ${statement.newDataType}`;
13660
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13661
+ columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
13662
+ } else if (statement.type === "alter_table_alter_column_set_autoincrement") {
13663
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13664
+ columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
13665
+ columnType = ` ${statement.newDataType}`;
13666
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13667
+ columnAutoincrement = "AUTO_INCREMENT";
13668
+ } else if (statement.type === "alter_table_alter_column_drop_autoincrement") {
13669
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13670
+ columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
13671
+ columnType = ` ${statement.newDataType}`;
13672
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13673
+ columnAutoincrement = "";
13674
+ } else {
13675
+ columnType = ` ${statement.newDataType}`;
13676
+ columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
13677
+ columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
13678
+ columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
13679
+ columnAutoincrement = statement.columnAutoIncrement ? "AUTO_INCREMENT" : "";
13680
+ }
13681
+ columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
13682
+ return `ALTER TABLE ${tableName} MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate};`;
13683
+ }
13684
+ };
13581
13685
  SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
13582
13686
  can(statement, dialect6) {
13583
13687
  return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "sqlite";
@@ -14029,6 +14133,16 @@ var init_sqlgenerator = __esm({
14029
14133
  `;
14030
14134
  }
14031
14135
  };
14136
+ MySqlDropIndexConvertor = class extends Convertor {
14137
+ can(statement, dialect6) {
14138
+ return statement.type === "drop_index" && dialect6 === "mysql";
14139
+ }
14140
+ convert(statement) {
14141
+ const tableName = typeof statement.schema === "undefined" ? `\`${statement.tableName}\`` : `\`${statement.schema}\`.\`${statement.tableName}\``;
14142
+ const { name } = MySqlSquasher.unsquashIdx(statement.data);
14143
+ return `DROP INDEX ${name} ON ${tableName};`;
14144
+ }
14145
+ };
14032
14146
  convertors = [];
14033
14147
  convertors.push(new PgCreateTableConvertor());
14034
14148
  convertors.push(new MySqlCreateTableConvertor());
@@ -14053,11 +14167,15 @@ var init_sqlgenerator = __esm({
14053
14167
  convertors.push(new CreateSqliteIndexConvertor());
14054
14168
  convertors.push(new PgDropIndexConvertor());
14055
14169
  convertors.push(new SqliteDropIndexConvertor());
14170
+ convertors.push(new MySqlDropIndexConvertor());
14056
14171
  convertors.push(new AlterTypeAddValueConvertor());
14057
14172
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
14058
14173
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
14059
14174
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
14060
14175
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
14176
+ convertors.push(new MySqlModifyColumn());
14177
+ convertors.push(new MySqlAlterTableAlterColumnSetDefaultConvertor());
14178
+ convertors.push(new MySqlAlterTableAlterColumnDropDefaultConvertor());
14061
14179
  convertors.push(new PgCreateForeignKeyConvertor());
14062
14180
  convertors.push(new MySqlCreateForeignKeyConvertor());
14063
14181
  convertors.push(new PgAlterForeignKeyConvertor());
@@ -14092,7 +14210,7 @@ var init_sqlgenerator = __esm({
14092
14210
  });
14093
14211
  const convertor = filtered.length === 1 ? filtered[0] : void 0;
14094
14212
  if (!convertor) {
14095
- console.log("no convertor:", statement.type);
14213
+ console.log("no convertor:", statement.type, dialect6);
14096
14214
  return "dry run";
14097
14215
  }
14098
14216
  return convertor.convert(statement);
@@ -14222,10 +14340,10 @@ var init_jsonStatements = __esm({
14222
14340
  };
14223
14341
  });
14224
14342
  };
14225
- prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, dialect6) => {
14343
+ prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, json2, dialect6) => {
14226
14344
  const addColumns = [];
14227
14345
  const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
14228
- const alterColumns = _prepareAlterColumns(tableName, schema4, altered);
14346
+ const alterColumns = _prepareAlterColumns(tableName, schema4, altered, json2);
14229
14347
  if (dialect6 === "sqlite") {
14230
14348
  let jsonCreateFKStatements = Object.values(addedFk);
14231
14349
  const sqliteAddColumns = _prepareSQLiteAddColumns(
@@ -14275,11 +14393,16 @@ var init_jsonStatements = __esm({
14275
14393
  };
14276
14394
  });
14277
14395
  };
14278
- _prepareAlterColumns = (tableName, schema4, columns) => {
14279
- var _a, _b, _c, _d, _e, _f, _g;
14396
+ _prepareAlterColumns = (tableName, schema4, columns, json2) => {
14397
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
14280
14398
  let statements = [];
14281
14399
  for (const column6 of columns) {
14282
14400
  const columnName = typeof column6.name !== "string" ? column6.name.new : column6.name;
14401
+ const columnType = json2.tables[tableName].columns[columnName].type;
14402
+ const columnDefault = json2.tables[tableName].columns[columnName].default;
14403
+ const columnOnUpdate = json2.tables[tableName].columns[columnName].onUpdate;
14404
+ const columnNotNull = json2.tables[tableName].columns[columnName].notNull;
14405
+ const columnAutoIncrement = json2.tables[tableName].columns[columnName].autoincrement;
14283
14406
  if (typeof column6.name !== "string") {
14284
14407
  statements.push({
14285
14408
  type: "alter_table_rename_column",
@@ -14295,7 +14418,11 @@ var init_jsonStatements = __esm({
14295
14418
  tableName,
14296
14419
  columnName,
14297
14420
  newDataType: column6.type.new,
14298
- schema: schema4
14421
+ schema: schema4,
14422
+ columnDefault,
14423
+ columnOnUpdate,
14424
+ columnNotNull,
14425
+ columnAutoIncrement
14299
14426
  });
14300
14427
  }
14301
14428
  if (((_b = column6.default) == null ? void 0 : _b.type) === "added") {
@@ -14329,7 +14456,12 @@ var init_jsonStatements = __esm({
14329
14456
  type: "alter_table_alter_column_set_notnull",
14330
14457
  tableName,
14331
14458
  columnName,
14332
- schema: schema4
14459
+ schema: schema4,
14460
+ newDataType: columnType,
14461
+ columnDefault,
14462
+ columnOnUpdate,
14463
+ columnNotNull,
14464
+ columnAutoIncrement
14333
14465
  });
14334
14466
  }
14335
14467
  if (((_f = column6.notNull) == null ? void 0 : _f.type) === "changed") {
@@ -14338,7 +14470,12 @@ var init_jsonStatements = __esm({
14338
14470
  type,
14339
14471
  tableName,
14340
14472
  columnName,
14341
- schema: schema4
14473
+ schema: schema4,
14474
+ newDataType: columnType,
14475
+ columnDefault,
14476
+ columnOnUpdate,
14477
+ columnNotNull,
14478
+ columnAutoIncrement
14342
14479
  });
14343
14480
  }
14344
14481
  if (((_g = column6.notNull) == null ? void 0 : _g.type) === "deleted") {
@@ -14346,7 +14483,78 @@ var init_jsonStatements = __esm({
14346
14483
  type: "alter_table_alter_column_drop_notnull",
14347
14484
  tableName,
14348
14485
  columnName,
14349
- schema: schema4
14486
+ schema: schema4,
14487
+ newDataType: columnType,
14488
+ columnDefault,
14489
+ columnOnUpdate,
14490
+ columnNotNull,
14491
+ columnAutoIncrement
14492
+ });
14493
+ }
14494
+ if (((_h = column6.autoincrement) == null ? void 0 : _h.type) === "added") {
14495
+ statements.push({
14496
+ type: "alter_table_alter_column_set_autoincrement",
14497
+ tableName,
14498
+ columnName,
14499
+ schema: schema4,
14500
+ newDataType: columnType,
14501
+ columnDefault,
14502
+ columnOnUpdate,
14503
+ columnNotNull,
14504
+ columnAutoIncrement
14505
+ });
14506
+ }
14507
+ if (((_i = column6.autoincrement) == null ? void 0 : _i.type) === "changed") {
14508
+ const type = column6.autoincrement.new ? "alter_table_alter_column_set_notnull" : "alter_table_alter_column_drop_notnull";
14509
+ statements.push({
14510
+ type,
14511
+ tableName,
14512
+ columnName,
14513
+ schema: schema4,
14514
+ newDataType: columnType,
14515
+ columnDefault,
14516
+ columnOnUpdate,
14517
+ columnNotNull,
14518
+ columnAutoIncrement
14519
+ });
14520
+ }
14521
+ if (((_j = column6.autoincrement) == null ? void 0 : _j.type) === "deleted") {
14522
+ statements.push({
14523
+ type: "alter_table_alter_column_drop_autoincrement",
14524
+ tableName,
14525
+ columnName,
14526
+ schema: schema4,
14527
+ newDataType: columnType,
14528
+ columnDefault,
14529
+ columnOnUpdate,
14530
+ columnNotNull,
14531
+ columnAutoIncrement
14532
+ });
14533
+ }
14534
+ if (((_k = column6.onUpdate) == null ? void 0 : _k.type) === "added") {
14535
+ statements.push({
14536
+ type: "alter_table_alter_column_set_on_update",
14537
+ tableName,
14538
+ columnName,
14539
+ schema: schema4,
14540
+ newDataType: columnType,
14541
+ columnDefault,
14542
+ columnOnUpdate,
14543
+ columnNotNull,
14544
+ columnAutoIncrement
14545
+ });
14546
+ }
14547
+ if (((_l = column6.onUpdate) == null ? void 0 : _l.type) === "deleted") {
14548
+ statements.push({
14549
+ type: "alter_table_alter_column_drop_on_update",
14550
+ tableName,
14551
+ columnName,
14552
+ schema: schema4,
14553
+ newDataType: columnType,
14554
+ columnDefault,
14555
+ columnOnUpdate,
14556
+ columnNotNull,
14557
+ columnAutoIncrement
14350
14558
  });
14351
14559
  }
14352
14560
  }
@@ -14517,13 +14725,16 @@ var init_snapshotsDiffer = __esm({
14517
14725
  unique: booleanType().optional(),
14518
14726
  default: anyType().optional(),
14519
14727
  notNull: booleanType().optional(),
14520
- autoincrement: booleanType().optional()
14728
+ autoincrement: booleanType().optional(),
14729
+ onUpdate: booleanType().optional()
14521
14730
  }).strict();
14522
14731
  alteredColumnSchema = objectType({
14523
14732
  name: makeSelfOrChanged(stringType()),
14524
14733
  type: makeChanged(stringType()).optional(),
14525
14734
  default: makePatched(anyType()).optional(),
14526
- notNull: makePatched(booleanType()).optional()
14735
+ notNull: makePatched(booleanType()).optional(),
14736
+ onUpdate: makePatched(booleanType()).optional(),
14737
+ autoincrement: makePatched(booleanType()).optional()
14527
14738
  }).strict();
14528
14739
  enumSchema2 = objectType({
14529
14740
  name: stringType(),
@@ -14731,6 +14942,7 @@ var init_snapshotsDiffer = __esm({
14731
14942
  it.added,
14732
14943
  it.altered,
14733
14944
  it.addedForeignKeys,
14945
+ json2,
14734
14946
  dialect6
14735
14947
  );
14736
14948
  }).flat().reduce(
@@ -14825,8 +15037,14 @@ var init_snapshotsDiffer = __esm({
14825
15037
  jsonStatements.push(...jsonRemoveTableFromSchemas);
14826
15038
  jsonStatements.push(...dropSchemas);
14827
15039
  const sqlStatements = fromJson(jsonStatements, dialect6);
15040
+ const uniqueSqlStatements = [];
15041
+ sqlStatements.forEach((ss) => {
15042
+ if (!uniqueSqlStatements.includes(ss)) {
15043
+ uniqueSqlStatements.push(ss);
15044
+ }
15045
+ });
14828
15046
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
14829
- return { statements: jsonStatements, sqlStatements, _meta };
15047
+ return { statements: jsonStatements, sqlStatements: uniqueSqlStatements, _meta };
14830
15048
  };
14831
15049
  }
14832
15050
  });
@@ -16153,13 +16371,14 @@ var init_words = __esm({
16153
16371
  });
16154
16372
 
16155
16373
  // src/cli/commands/upFolders.ts
16156
- var import_fs, import_path, schemasResolverWithSQL, resolveSchemas, resolveTablesWithSQL, resolveTables, resolveColumnsWithSQL, resolveColumns, fullfill, fullfillpg, fullfillmysql, upgradeFolders;
16374
+ var import_fs, import_path, schemasResolverWithSQL, resolveSchemas, resolveTablesWithSQL, resolveTables, resolveColumnsWithSQL, resolveColumns, fullfill, fullfillpg, fullfillmysql, fullfillsqlite, upgradeFolders;
16157
16375
  var init_upFolders = __esm({
16158
16376
  "src/cli/commands/upFolders.ts"() {
16159
16377
  import_fs = require("fs");
16160
16378
  import_path = require("path");
16161
16379
  init_jsonDiffer();
16162
16380
  init_mysqlSchema();
16381
+ init_sqliteSchema();
16163
16382
  init_snapshotsDiffer();
16164
16383
  init_utils();
16165
16384
  init_words();
@@ -16231,6 +16450,10 @@ var init_upFolders = __esm({
16231
16450
  {
16232
16451
  value: it,
16233
16452
  sql: `RENAME TABLE ${mysqlSchemaPrefix}\`${it.name}\` TO ${mysqlSchemaPrefix}\`${created.name}\`;`
16453
+ },
16454
+ {
16455
+ value: it,
16456
+ sql: `ALTER TABLE ${it.name} RENAME TO ${created.name};`
16234
16457
  }
16235
16458
  ];
16236
16459
  }).flat();
@@ -16341,6 +16564,9 @@ var init_upFolders = __esm({
16341
16564
  if (dialect6 === "mysql") {
16342
16565
  return fullfillmysql(prev, cur, sql);
16343
16566
  }
16567
+ if (dialect6 === "sqlite") {
16568
+ return fullfillsqlite(prev, cur, sql);
16569
+ }
16344
16570
  throw new Error("");
16345
16571
  };
16346
16572
  fullfillpg = (prev, cur, sql) => {
@@ -16398,7 +16624,12 @@ var init_upFolders = __esm({
16398
16624
  });
16399
16625
  const rColumns = allAltered.map((table4) => {
16400
16626
  const name = table4.name;
16401
- const result = resolveColumnsWithSQL(name, table4.deleted, table4.added, sql);
16627
+ const result = resolveColumnsWithSQL(
16628
+ name,
16629
+ table4.deleted,
16630
+ table4.added,
16631
+ sql
16632
+ );
16402
16633
  const tableName = table4.name;
16403
16634
  const schema4 = typeof table4.schema === "string" ? table4.schema : "";
16404
16635
  return result.renamed.map((it) => {
@@ -16485,7 +16716,12 @@ var init_upFolders = __esm({
16485
16716
  });
16486
16717
  const rColumns = allAltered.map((table4) => {
16487
16718
  const name = table4.name;
16488
- const result = resolveColumnsWithSQL(name, table4.deleted, table4.added, sql);
16719
+ const result = resolveColumnsWithSQL(
16720
+ name,
16721
+ table4.deleted,
16722
+ table4.added,
16723
+ sql
16724
+ );
16489
16725
  const tableName = table4.name;
16490
16726
  const schema4 = typeof table4.schema === "string" ? table4.schema : "";
16491
16727
  return result.renamed.map((it) => {
@@ -16516,6 +16752,95 @@ var init_upFolders = __esm({
16516
16752
  _meta
16517
16753
  };
16518
16754
  };
16755
+ fullfillsqlite = (prev, cur, sql) => {
16756
+ const b = sqliteSchemaV4.parse(cur);
16757
+ if (!prev) {
16758
+ return {
16759
+ version: "5",
16760
+ dialect: b.dialect,
16761
+ id: b.id,
16762
+ prevId: b.prevId,
16763
+ tables: b.tables,
16764
+ enums: {},
16765
+ _meta: {
16766
+ tables: {},
16767
+ columns: {}
16768
+ }
16769
+ };
16770
+ }
16771
+ const a = sqliteSchemaV4.parse(prev);
16772
+ const json1 = squashSqliteScheme(a);
16773
+ const json2 = squashSqliteScheme(b);
16774
+ const diffResult = applyJsonDiff(json1, json2);
16775
+ const parseResult = diffResultScheme.safeParse(diffResult);
16776
+ if (!parseResult.success) {
16777
+ parseResult.error.errors.forEach((it) => {
16778
+ console.error(it);
16779
+ });
16780
+ throw new Error();
16781
+ }
16782
+ const typedResult = parseResult.data;
16783
+ const { renamed: renamedSchemas } = schemasResolverWithSQL(
16784
+ typedResult.deletedSchemas.map((it) => ({ name: it })),
16785
+ typedResult.addedSchemas.map((it) => ({ name: it })),
16786
+ sql
16787
+ );
16788
+ const { renamed } = resolveTablesWithSQL(
16789
+ typedResult.deletedTables,
16790
+ typedResult.addedTables,
16791
+ sql
16792
+ );
16793
+ const renamedWithAlternations = Object.values(
16794
+ alteredTableScheme.array().parse(diffForRenamedTables(renamed))
16795
+ );
16796
+ const allAltered = typedResult.alteredTablesWithColumns.concat(
16797
+ renamedWithAlternations
16798
+ );
16799
+ const rSchemas = renamedSchemas.map((it) => ({
16800
+ from: it.from.name,
16801
+ to: it.to.name
16802
+ }));
16803
+ const rTables = renamed.map((it) => {
16804
+ return { from: it.from, to: it.to };
16805
+ });
16806
+ const rColumns = allAltered.map((table4) => {
16807
+ const name = table4.name;
16808
+ const result = resolveColumnsWithSQL(
16809
+ name,
16810
+ table4.deleted,
16811
+ table4.added,
16812
+ sql
16813
+ );
16814
+ const tableName = table4.name;
16815
+ const schema4 = typeof table4.schema === "string" ? table4.schema : "";
16816
+ return result.renamed.map((it) => {
16817
+ return {
16818
+ from: { schema: schema4, table: tableName, column: it.from.name },
16819
+ to: { schema: schema4, table: tableName, column: it.to.name }
16820
+ };
16821
+ });
16822
+ }).flat();
16823
+ const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
16824
+ const bpatched = {
16825
+ version: "5",
16826
+ dialect: b.dialect,
16827
+ id: b.id,
16828
+ prevId: b.prevId,
16829
+ tables: b.tables,
16830
+ enums: {},
16831
+ _meta
16832
+ };
16833
+ sqliteSchema.parse(bpatched);
16834
+ return {
16835
+ version: "5",
16836
+ dialect: b.dialect,
16837
+ id: b.id,
16838
+ prevId: b.prevId,
16839
+ tables: b.tables,
16840
+ enums: {},
16841
+ _meta
16842
+ };
16843
+ };
16519
16844
  upgradeFolders = (dialect6, out) => {
16520
16845
  const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
16521
16846
  (it) => it.length === 14 && /^\d+$/.test(it)
@@ -16530,17 +16855,18 @@ var init_upFolders = __esm({
16530
16855
  date.setUTCHours(Number(it.substring(8, 10)));
16531
16856
  date.setUTCMinutes(Number(it.substring(10, 12)));
16532
16857
  date.setUTCSeconds(Number(it.substring(12, 14)));
16533
- const path4 = (0, import_path.join)(out, it);
16858
+ const path2 = (0, import_path.join)(out, it);
16534
16859
  const pathJson = (0, import_path.join)(out, it, "snapshot.json");
16535
16860
  const pathSQL = (0, import_path.join)(out, it, "migration.sql");
16536
16861
  const snapshot = JSON.parse((0, import_fs.readFileSync)(pathJson).toString());
16537
16862
  const sql = (0, import_fs.readFileSync)(pathSQL).toString();
16538
16863
  res2.entries.push({
16539
16864
  idx: res2.idx,
16865
+ version: snapshot["version"],
16540
16866
  json: snapshot,
16541
16867
  date,
16542
16868
  sql,
16543
- path: path4
16869
+ path: path2
16544
16870
  });
16545
16871
  res2.idx += 1;
16546
16872
  return res2;
@@ -16560,6 +16886,7 @@ var init_upFolders = __esm({
16560
16886
  const { prefix, suffix, tag } = prepareMigrationMetadata(it.idx);
16561
16887
  journal.entries.push({
16562
16888
  idx: it.idx,
16889
+ version: it.version,
16563
16890
  when: +it.date,
16564
16891
  tag,
16565
16892
  breakpoints: false
@@ -16649,7 +16976,7 @@ var init_utils = __esm({
16649
16976
  case "pg":
16650
16977
  return { validator: backwardCompatiblePgSchema, version: 5 };
16651
16978
  case "sqlite":
16652
- return { validator: backwardCompatibleSqliteSchema, version: 4 };
16979
+ return { validator: backwardCompatibleSqliteSchema, version: 5 };
16653
16980
  case "mysql":
16654
16981
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
16655
16982
  }
@@ -17682,16 +18009,16 @@ var require_node2 = __commonJS({
17682
18009
  }
17683
18010
  exports2.urlGenerate = urlGenerate;
17684
18011
  function normalize(aPath) {
17685
- var path4 = aPath;
18012
+ var path2 = aPath;
17686
18013
  var url = urlParse(aPath);
17687
18014
  if (url) {
17688
18015
  if (!url.path) {
17689
18016
  return aPath;
17690
18017
  }
17691
- path4 = url.path;
18018
+ path2 = url.path;
17692
18019
  }
17693
- var isAbsolute = exports2.isAbsolute(path4);
17694
- var parts = path4.split(/\/+/);
18020
+ var isAbsolute = exports2.isAbsolute(path2);
18021
+ var parts = path2.split(/\/+/);
17695
18022
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
17696
18023
  part = parts[i];
17697
18024
  if (part === ".") {
@@ -17708,15 +18035,15 @@ var require_node2 = __commonJS({
17708
18035
  }
17709
18036
  }
17710
18037
  }
17711
- path4 = parts.join("/");
17712
- if (path4 === "") {
17713
- path4 = isAbsolute ? "/" : ".";
18038
+ path2 = parts.join("/");
18039
+ if (path2 === "") {
18040
+ path2 = isAbsolute ? "/" : ".";
17714
18041
  }
17715
18042
  if (url) {
17716
- url.path = path4;
18043
+ url.path = path2;
17717
18044
  return urlGenerate(url);
17718
18045
  }
17719
- return path4;
18046
+ return path2;
17720
18047
  }
17721
18048
  exports2.normalize = normalize;
17722
18049
  function join22(aRoot, aPath) {
@@ -19246,7 +19573,7 @@ var require_node2 = __commonJS({
19246
19573
  });
19247
19574
  var require_source_map_support = __commonJS2((exports2, module22) => {
19248
19575
  var SourceMapConsumer = require_source_map().SourceMapConsumer;
19249
- var path4 = require("path");
19576
+ var path2 = require("path");
19250
19577
  var fs32;
19251
19578
  try {
19252
19579
  fs32 = require("fs");
@@ -19319,15 +19646,15 @@ var require_node2 = __commonJS({
19319
19646
  function supportRelativeURL(file, url) {
19320
19647
  if (!file)
19321
19648
  return url;
19322
- var dir = path4.dirname(file);
19649
+ var dir = path2.dirname(file);
19323
19650
  var match = /^\w+:\/\/[^\/]*/.exec(dir);
19324
19651
  var protocol = match ? match[0] : "";
19325
19652
  var startPath = dir.slice(protocol.length);
19326
19653
  if (protocol && /^\/\w\:/.test(startPath)) {
19327
19654
  protocol += "/";
19328
- return protocol + path4.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
19655
+ return protocol + path2.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
19329
19656
  }
19330
- return protocol + path4.resolve(dir.slice(protocol.length), url);
19657
+ return protocol + path2.resolve(dir.slice(protocol.length), url);
19331
19658
  }
19332
19659
  function retrieveSourceMapURL(source) {
19333
19660
  var fileData;
@@ -20122,9 +20449,9 @@ var require_node2 = __commonJS({
20122
20449
  "use strict";
20123
20450
  Object.defineProperty(exports2, "__esModule", { value: true });
20124
20451
  var fs32 = require("fs");
20125
- function fileExistsSync(path4) {
20452
+ function fileExistsSync(path2) {
20126
20453
  try {
20127
- var stats = fs32.statSync(path4);
20454
+ var stats = fs32.statSync(path2);
20128
20455
  return stats.isFile();
20129
20456
  } catch (err2) {
20130
20457
  return false;
@@ -20138,8 +20465,8 @@ var require_node2 = __commonJS({
20138
20465
  return require(packageJsonPath);
20139
20466
  }
20140
20467
  exports2.readJsonFromDiskSync = readJsonFromDiskSync;
20141
- function readJsonFromDiskAsync(path4, callback) {
20142
- fs32.readFile(path4, "utf8", function(err2, result) {
20468
+ function readJsonFromDiskAsync(path2, callback) {
20469
+ fs32.readFile(path2, "utf8", function(err2, result) {
20143
20470
  if (err2 || !result) {
20144
20471
  return callback();
20145
20472
  }
@@ -20148,8 +20475,8 @@ var require_node2 = __commonJS({
20148
20475
  });
20149
20476
  }
20150
20477
  exports2.readJsonFromDiskAsync = readJsonFromDiskAsync;
20151
- function fileExistsAsync(path22, callback2) {
20152
- fs32.stat(path22, function(err2, stats) {
20478
+ function fileExistsAsync(path2, callback2) {
20479
+ fs32.stat(path2, function(err2, stats) {
20153
20480
  if (err2) {
20154
20481
  return callback2(void 0, false);
20155
20482
  }
@@ -20157,15 +20484,15 @@ var require_node2 = __commonJS({
20157
20484
  });
20158
20485
  }
20159
20486
  exports2.fileExistsAsync = fileExistsAsync;
20160
- function removeExtension(path4) {
20161
- return path4.substring(0, path4.lastIndexOf(".")) || path4;
20487
+ function removeExtension(path2) {
20488
+ return path2.substring(0, path2.lastIndexOf(".")) || path2;
20162
20489
  }
20163
20490
  exports2.removeExtension = removeExtension;
20164
20491
  });
20165
20492
  var require_mapping_entry = __commonJS2((exports2) => {
20166
20493
  "use strict";
20167
20494
  Object.defineProperty(exports2, "__esModule", { value: true });
20168
- var path4 = require("path");
20495
+ var path2 = require("path");
20169
20496
  function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
20170
20497
  var sortedKeys = sortByLongestPrefix(Object.keys(paths));
20171
20498
  var absolutePaths = [];
@@ -20174,7 +20501,7 @@ var require_node2 = __commonJS({
20174
20501
  absolutePaths.push({
20175
20502
  pattern: key,
20176
20503
  paths: paths[key].map(function(pathToResolve) {
20177
- return path4.join(absoluteBaseUrl, pathToResolve);
20504
+ return path2.join(absoluteBaseUrl, pathToResolve);
20178
20505
  })
20179
20506
  });
20180
20507
  }
@@ -20200,11 +20527,11 @@ var require_node2 = __commonJS({
20200
20527
  var require_try_path = __commonJS2((exports2) => {
20201
20528
  "use strict";
20202
20529
  Object.defineProperty(exports2, "__esModule", { value: true });
20203
- var path4 = require("path");
20530
+ var path2 = require("path");
20204
20531
  var path_1 = require("path");
20205
20532
  var filesystem_1 = require_filesystem();
20206
20533
  function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
20207
- if (!absolutePathMappings || !requestedModule || requestedModule[0] === "." || requestedModule[0] === path4.sep) {
20534
+ if (!absolutePathMappings || !requestedModule || requestedModule[0] === "." || requestedModule[0] === path2.sep) {
20208
20535
  return void 0;
20209
20536
  }
20210
20537
  var pathsToTry = [];
@@ -20220,9 +20547,9 @@ var require_node2 = __commonJS({
20220
20547
  }));
20221
20548
  pathsToTry.push({
20222
20549
  type: "package",
20223
- path: path4.join(physicalPath, "/package.json")
20550
+ path: path2.join(physicalPath, "/package.json")
20224
20551
  });
20225
- var indexPath = path4.join(physicalPath, "/index");
20552
+ var indexPath = path2.join(physicalPath, "/index");
20226
20553
  pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
20227
20554
  return { type: "index", path: indexPath + e };
20228
20555
  }));
@@ -20269,7 +20596,7 @@ var require_node2 = __commonJS({
20269
20596
  var require_match_path_sync = __commonJS2((exports2) => {
20270
20597
  "use strict";
20271
20598
  Object.defineProperty(exports2, "__esModule", { value: true });
20272
- var path4 = require("path");
20599
+ var path2 = require("path");
20273
20600
  var Filesystem = require_filesystem();
20274
20601
  var MappingEntry = require_mapping_entry();
20275
20602
  var TryPath = require_try_path();
@@ -20311,7 +20638,7 @@ var require_node2 = __commonJS({
20311
20638
  var mainFieldName = mainFields[index4];
20312
20639
  var candidateMapping = packageJson[mainFieldName];
20313
20640
  if (candidateMapping && typeof candidateMapping === "string") {
20314
- var candidateFilePath = path4.join(path4.dirname(packageJsonPath), candidateMapping);
20641
+ var candidateFilePath = path2.join(path2.dirname(packageJsonPath), candidateMapping);
20315
20642
  if (fileExists(candidateFilePath)) {
20316
20643
  return candidateFilePath;
20317
20644
  }
@@ -20350,7 +20677,7 @@ var require_node2 = __commonJS({
20350
20677
  var require_match_path_async = __commonJS2((exports2) => {
20351
20678
  "use strict";
20352
20679
  Object.defineProperty(exports2, "__esModule", { value: true });
20353
- var path4 = require("path");
20680
+ var path2 = require("path");
20354
20681
  var TryPath = require_try_path();
20355
20682
  var MappingEntry = require_mapping_entry();
20356
20683
  var Filesystem = require_filesystem();
@@ -20401,7 +20728,7 @@ var require_node2 = __commonJS({
20401
20728
  if (typeof mainFieldMapping !== "string") {
20402
20729
  return tryNext();
20403
20730
  }
20404
- var mappedFilePath = path4.join(path4.dirname(packageJsonPath), mainFieldMapping);
20731
+ var mappedFilePath = path2.join(path2.dirname(packageJsonPath), mainFieldMapping);
20405
20732
  fileExistsAsync(mappedFilePath, function(err2, exists) {
20406
20733
  if (err2) {
20407
20734
  return doneCallback(err2);
@@ -21621,7 +21948,7 @@ var require_node2 = __commonJS({
21621
21948
  return t;
21622
21949
  };
21623
21950
  Object.defineProperty(exports2, "__esModule", { value: true });
21624
- var path4 = require("path");
21951
+ var path2 = require("path");
21625
21952
  var fs32 = require("fs");
21626
21953
  var JSON5 = require_lib32();
21627
21954
  var StripBom = require_strip_bom();
@@ -21651,24 +21978,24 @@ var require_node2 = __commonJS({
21651
21978
  }
21652
21979
  function resolveConfigPath(cwd, filename) {
21653
21980
  if (filename) {
21654
- var absolutePath = fs32.lstatSync(filename).isDirectory() ? path4.resolve(filename, "./tsconfig.json") : path4.resolve(cwd, filename);
21981
+ var absolutePath = fs32.lstatSync(filename).isDirectory() ? path2.resolve(filename, "./tsconfig.json") : path2.resolve(cwd, filename);
21655
21982
  return absolutePath;
21656
21983
  }
21657
21984
  if (fs32.statSync(cwd).isFile()) {
21658
- return path4.resolve(cwd);
21985
+ return path2.resolve(cwd);
21659
21986
  }
21660
21987
  var configAbsolutePath = walkForTsConfig(cwd);
21661
- return configAbsolutePath ? path4.resolve(configAbsolutePath) : void 0;
21988
+ return configAbsolutePath ? path2.resolve(configAbsolutePath) : void 0;
21662
21989
  }
21663
21990
  function walkForTsConfig(directory, existsSync4) {
21664
21991
  if (existsSync4 === void 0) {
21665
21992
  existsSync4 = fs32.existsSync;
21666
21993
  }
21667
- var configPath = path4.join(directory, "./tsconfig.json");
21994
+ var configPath = path2.join(directory, "./tsconfig.json");
21668
21995
  if (existsSync4(configPath)) {
21669
21996
  return configPath;
21670
21997
  }
21671
- var parentDirectory = path4.join(directory, "../");
21998
+ var parentDirectory = path2.join(directory, "../");
21672
21999
  if (directory === parentDirectory) {
21673
22000
  return void 0;
21674
22001
  }
@@ -21695,15 +22022,15 @@ var require_node2 = __commonJS({
21695
22022
  if (typeof extendedConfig === "string" && extendedConfig.indexOf(".json") === -1) {
21696
22023
  extendedConfig += ".json";
21697
22024
  }
21698
- var currentDir = path4.dirname(configFilePath);
21699
- var extendedConfigPath = path4.join(currentDir, extendedConfig);
22025
+ var currentDir = path2.dirname(configFilePath);
22026
+ var extendedConfigPath = path2.join(currentDir, extendedConfig);
21700
22027
  if (extendedConfig.indexOf("/") !== -1 && extendedConfig.indexOf(".") !== -1 && !existsSync4(extendedConfigPath)) {
21701
- extendedConfigPath = path4.join(currentDir, "node_modules", extendedConfig);
22028
+ extendedConfigPath = path2.join(currentDir, "node_modules", extendedConfig);
21702
22029
  }
21703
22030
  var base = loadTsconfig(extendedConfigPath, existsSync4, readFileSync4) || {};
21704
22031
  if (base.compilerOptions && base.compilerOptions.baseUrl) {
21705
- var extendsDir = path4.dirname(extendedConfig);
21706
- base.compilerOptions.baseUrl = path4.join(extendsDir, base.compilerOptions.baseUrl);
22032
+ var extendsDir = path2.dirname(extendedConfig);
22033
+ base.compilerOptions.baseUrl = path2.join(extendsDir, base.compilerOptions.baseUrl);
21707
22034
  }
21708
22035
  return __assign({}, base, config, { compilerOptions: __assign({}, base.compilerOptions, config.compilerOptions) });
21709
22036
  }
@@ -21928,7 +22255,7 @@ var require_node2 = __commonJS({
21928
22255
  "use strict";
21929
22256
  Object.defineProperty(exports2, "__esModule", { value: true });
21930
22257
  var TsConfigLoader = require_tsconfig_loader();
21931
- var path4 = require("path");
22258
+ var path2 = require("path");
21932
22259
  var options_1 = require_options();
21933
22260
  function loadConfig2(cwd) {
21934
22261
  if (cwd === void 0) {
@@ -21940,7 +22267,7 @@ var require_node2 = __commonJS({
21940
22267
  function configLoader(_a) {
21941
22268
  var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader.tsConfigLoader : _b;
21942
22269
  if (explicitParams) {
21943
- var absoluteBaseUrl_1 = path4.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path4.join(cwd, explicitParams.baseUrl);
22270
+ var absoluteBaseUrl_1 = path2.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path2.join(cwd, explicitParams.baseUrl);
21944
22271
  return {
21945
22272
  resultType: "success",
21946
22273
  configFileAbsolutePath: "",
@@ -21969,8 +22296,8 @@ var require_node2 = __commonJS({
21969
22296
  message: "Missing baseUrl in compilerOptions"
21970
22297
  };
21971
22298
  }
21972
- var tsConfigDir = path4.dirname(loadResult.tsConfigPath);
21973
- var absoluteBaseUrl = path4.join(tsConfigDir, loadResult.baseUrl);
22299
+ var tsConfigDir = path2.dirname(loadResult.tsConfigPath);
22300
+ var absoluteBaseUrl = path2.join(tsConfigDir, loadResult.baseUrl);
21974
22301
  return {
21975
22302
  resultType: "success",
21976
22303
  configFileAbsolutePath: loadResult.tsConfigPath,
@@ -22171,8 +22498,8 @@ var require_node2 = __commonJS({
22171
22498
  });
22172
22499
  var getOptions = (cwd) => {
22173
22500
  var _a, _b, _c, _d;
22174
- const { data, path: path4 } = joycon.loadSync(["tsconfig.json", "jsconfig.json"], cwd);
22175
- if (path4 && data) {
22501
+ const { data, path: path2 } = joycon.loadSync(["tsconfig.json", "jsconfig.json"], cwd);
22502
+ if (path2 && data) {
22176
22503
  return {
22177
22504
  jsxFactory: (_a = data.compilerOptions) == null ? void 0 : _a.jsxFactory,
22178
22505
  jsxFragment: (_b = data.compilerOptions) == null ? void 0 : _b.jsxFragmentFactory,
@@ -22337,6 +22664,2337 @@ var require_node2 = __commonJS({
22337
22664
  }
22338
22665
  });
22339
22666
 
22667
+ // node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
22668
+ var require_old = __commonJS({
22669
+ "node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports) {
22670
+ var pathModule = require("path");
22671
+ var isWindows = process.platform === "win32";
22672
+ var fs7 = require("fs");
22673
+ var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
22674
+ function rethrow() {
22675
+ var callback;
22676
+ if (DEBUG) {
22677
+ var backtrace = new Error();
22678
+ callback = debugCallback;
22679
+ } else
22680
+ callback = missingCallback;
22681
+ return callback;
22682
+ function debugCallback(err2) {
22683
+ if (err2) {
22684
+ backtrace.message = err2.message;
22685
+ err2 = backtrace;
22686
+ missingCallback(err2);
22687
+ }
22688
+ }
22689
+ function missingCallback(err2) {
22690
+ if (err2) {
22691
+ if (process.throwDeprecation)
22692
+ throw err2;
22693
+ else if (!process.noDeprecation) {
22694
+ var msg = "fs: missing callback " + (err2.stack || err2.message);
22695
+ if (process.traceDeprecation)
22696
+ console.trace(msg);
22697
+ else
22698
+ console.error(msg);
22699
+ }
22700
+ }
22701
+ }
22702
+ }
22703
+ function maybeCallback(cb) {
22704
+ return typeof cb === "function" ? cb : rethrow();
22705
+ }
22706
+ var normalize = pathModule.normalize;
22707
+ if (isWindows) {
22708
+ nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
22709
+ } else {
22710
+ nextPartRe = /(.*?)(?:[\/]+|$)/g;
22711
+ }
22712
+ var nextPartRe;
22713
+ if (isWindows) {
22714
+ splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
22715
+ } else {
22716
+ splitRootRe = /^[\/]*/;
22717
+ }
22718
+ var splitRootRe;
22719
+ exports.realpathSync = function realpathSync(p, cache) {
22720
+ p = pathModule.resolve(p);
22721
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
22722
+ return cache[p];
22723
+ }
22724
+ var original = p, seenLinks = {}, knownHard = {};
22725
+ var pos;
22726
+ var current;
22727
+ var base;
22728
+ var previous;
22729
+ start();
22730
+ function start() {
22731
+ var m = splitRootRe.exec(p);
22732
+ pos = m[0].length;
22733
+ current = m[0];
22734
+ base = m[0];
22735
+ previous = "";
22736
+ if (isWindows && !knownHard[base]) {
22737
+ fs7.lstatSync(base);
22738
+ knownHard[base] = true;
22739
+ }
22740
+ }
22741
+ while (pos < p.length) {
22742
+ nextPartRe.lastIndex = pos;
22743
+ var result = nextPartRe.exec(p);
22744
+ previous = current;
22745
+ current += result[0];
22746
+ base = previous + result[1];
22747
+ pos = nextPartRe.lastIndex;
22748
+ if (knownHard[base] || cache && cache[base] === base) {
22749
+ continue;
22750
+ }
22751
+ var resolvedLink;
22752
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
22753
+ resolvedLink = cache[base];
22754
+ } else {
22755
+ var stat = fs7.lstatSync(base);
22756
+ if (!stat.isSymbolicLink()) {
22757
+ knownHard[base] = true;
22758
+ if (cache)
22759
+ cache[base] = base;
22760
+ continue;
22761
+ }
22762
+ var linkTarget = null;
22763
+ if (!isWindows) {
22764
+ var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
22765
+ if (seenLinks.hasOwnProperty(id)) {
22766
+ linkTarget = seenLinks[id];
22767
+ }
22768
+ }
22769
+ if (linkTarget === null) {
22770
+ fs7.statSync(base);
22771
+ linkTarget = fs7.readlinkSync(base);
22772
+ }
22773
+ resolvedLink = pathModule.resolve(previous, linkTarget);
22774
+ if (cache)
22775
+ cache[base] = resolvedLink;
22776
+ if (!isWindows)
22777
+ seenLinks[id] = linkTarget;
22778
+ }
22779
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
22780
+ start();
22781
+ }
22782
+ if (cache)
22783
+ cache[original] = p;
22784
+ return p;
22785
+ };
22786
+ exports.realpath = function realpath(p, cache, cb) {
22787
+ if (typeof cb !== "function") {
22788
+ cb = maybeCallback(cache);
22789
+ cache = null;
22790
+ }
22791
+ p = pathModule.resolve(p);
22792
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
22793
+ return process.nextTick(cb.bind(null, null, cache[p]));
22794
+ }
22795
+ var original = p, seenLinks = {}, knownHard = {};
22796
+ var pos;
22797
+ var current;
22798
+ var base;
22799
+ var previous;
22800
+ start();
22801
+ function start() {
22802
+ var m = splitRootRe.exec(p);
22803
+ pos = m[0].length;
22804
+ current = m[0];
22805
+ base = m[0];
22806
+ previous = "";
22807
+ if (isWindows && !knownHard[base]) {
22808
+ fs7.lstat(base, function(err2) {
22809
+ if (err2)
22810
+ return cb(err2);
22811
+ knownHard[base] = true;
22812
+ LOOP();
22813
+ });
22814
+ } else {
22815
+ process.nextTick(LOOP);
22816
+ }
22817
+ }
22818
+ function LOOP() {
22819
+ if (pos >= p.length) {
22820
+ if (cache)
22821
+ cache[original] = p;
22822
+ return cb(null, p);
22823
+ }
22824
+ nextPartRe.lastIndex = pos;
22825
+ var result = nextPartRe.exec(p);
22826
+ previous = current;
22827
+ current += result[0];
22828
+ base = previous + result[1];
22829
+ pos = nextPartRe.lastIndex;
22830
+ if (knownHard[base] || cache && cache[base] === base) {
22831
+ return process.nextTick(LOOP);
22832
+ }
22833
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
22834
+ return gotResolvedLink(cache[base]);
22835
+ }
22836
+ return fs7.lstat(base, gotStat);
22837
+ }
22838
+ function gotStat(err2, stat) {
22839
+ if (err2)
22840
+ return cb(err2);
22841
+ if (!stat.isSymbolicLink()) {
22842
+ knownHard[base] = true;
22843
+ if (cache)
22844
+ cache[base] = base;
22845
+ return process.nextTick(LOOP);
22846
+ }
22847
+ if (!isWindows) {
22848
+ var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
22849
+ if (seenLinks.hasOwnProperty(id)) {
22850
+ return gotTarget(null, seenLinks[id], base);
22851
+ }
22852
+ }
22853
+ fs7.stat(base, function(err3) {
22854
+ if (err3)
22855
+ return cb(err3);
22856
+ fs7.readlink(base, function(err4, target) {
22857
+ if (!isWindows)
22858
+ seenLinks[id] = target;
22859
+ gotTarget(err4, target);
22860
+ });
22861
+ });
22862
+ }
22863
+ function gotTarget(err2, target, base2) {
22864
+ if (err2)
22865
+ return cb(err2);
22866
+ var resolvedLink = pathModule.resolve(previous, target);
22867
+ if (cache)
22868
+ cache[base2] = resolvedLink;
22869
+ gotResolvedLink(resolvedLink);
22870
+ }
22871
+ function gotResolvedLink(resolvedLink) {
22872
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
22873
+ start();
22874
+ }
22875
+ };
22876
+ }
22877
+ });
22878
+
22879
+ // node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js
22880
+ var require_fs = __commonJS({
22881
+ "node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js"(exports, module2) {
22882
+ module2.exports = realpath;
22883
+ realpath.realpath = realpath;
22884
+ realpath.sync = realpathSync;
22885
+ realpath.realpathSync = realpathSync;
22886
+ realpath.monkeypatch = monkeypatch;
22887
+ realpath.unmonkeypatch = unmonkeypatch;
22888
+ var fs7 = require("fs");
22889
+ var origRealpath = fs7.realpath;
22890
+ var origRealpathSync = fs7.realpathSync;
22891
+ var version = process.version;
22892
+ var ok = /^v[0-5]\./.test(version);
22893
+ var old = require_old();
22894
+ function newError(er) {
22895
+ return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
22896
+ }
22897
+ function realpath(p, cache, cb) {
22898
+ if (ok) {
22899
+ return origRealpath(p, cache, cb);
22900
+ }
22901
+ if (typeof cache === "function") {
22902
+ cb = cache;
22903
+ cache = null;
22904
+ }
22905
+ origRealpath(p, cache, function(er, result) {
22906
+ if (newError(er)) {
22907
+ old.realpath(p, cache, cb);
22908
+ } else {
22909
+ cb(er, result);
22910
+ }
22911
+ });
22912
+ }
22913
+ function realpathSync(p, cache) {
22914
+ if (ok) {
22915
+ return origRealpathSync(p, cache);
22916
+ }
22917
+ try {
22918
+ return origRealpathSync(p, cache);
22919
+ } catch (er) {
22920
+ if (newError(er)) {
22921
+ return old.realpathSync(p, cache);
22922
+ } else {
22923
+ throw er;
22924
+ }
22925
+ }
22926
+ }
22927
+ function monkeypatch() {
22928
+ fs7.realpath = realpath;
22929
+ fs7.realpathSync = realpathSync;
22930
+ }
22931
+ function unmonkeypatch() {
22932
+ fs7.realpath = origRealpath;
22933
+ fs7.realpathSync = origRealpathSync;
22934
+ }
22935
+ }
22936
+ });
22937
+
22938
+ // node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js
22939
+ var require_path = __commonJS({
22940
+ "node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports, module2) {
22941
+ var isWindows = typeof process === "object" && process && process.platform === "win32";
22942
+ module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
22943
+ }
22944
+ });
22945
+
22946
+ // node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
22947
+ var require_balanced_match = __commonJS({
22948
+ "node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module2) {
22949
+ "use strict";
22950
+ module2.exports = balanced;
22951
+ function balanced(a, b, str) {
22952
+ if (a instanceof RegExp)
22953
+ a = maybeMatch(a, str);
22954
+ if (b instanceof RegExp)
22955
+ b = maybeMatch(b, str);
22956
+ var r = range(a, b, str);
22957
+ return r && {
22958
+ start: r[0],
22959
+ end: r[1],
22960
+ pre: str.slice(0, r[0]),
22961
+ body: str.slice(r[0] + a.length, r[1]),
22962
+ post: str.slice(r[1] + b.length)
22963
+ };
22964
+ }
22965
+ function maybeMatch(reg, str) {
22966
+ var m = str.match(reg);
22967
+ return m ? m[0] : null;
22968
+ }
22969
+ balanced.range = range;
22970
+ function range(a, b, str) {
22971
+ var begs, beg, left, right, result;
22972
+ var ai = str.indexOf(a);
22973
+ var bi = str.indexOf(b, ai + 1);
22974
+ var i = ai;
22975
+ if (ai >= 0 && bi > 0) {
22976
+ if (a === b) {
22977
+ return [ai, bi];
22978
+ }
22979
+ begs = [];
22980
+ left = str.length;
22981
+ while (i >= 0 && !result) {
22982
+ if (i == ai) {
22983
+ begs.push(i);
22984
+ ai = str.indexOf(a, i + 1);
22985
+ } else if (begs.length == 1) {
22986
+ result = [begs.pop(), bi];
22987
+ } else {
22988
+ beg = begs.pop();
22989
+ if (beg < left) {
22990
+ left = beg;
22991
+ right = bi;
22992
+ }
22993
+ bi = str.indexOf(b, i + 1);
22994
+ }
22995
+ i = ai < bi && ai >= 0 ? ai : bi;
22996
+ }
22997
+ if (begs.length) {
22998
+ result = [left, right];
22999
+ }
23000
+ }
23001
+ return result;
23002
+ }
23003
+ }
23004
+ });
23005
+
23006
+ // node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
23007
+ var require_brace_expansion = __commonJS({
23008
+ "node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module2) {
23009
+ var balanced = require_balanced_match();
23010
+ module2.exports = expandTop;
23011
+ var escSlash = "\0SLASH" + Math.random() + "\0";
23012
+ var escOpen = "\0OPEN" + Math.random() + "\0";
23013
+ var escClose = "\0CLOSE" + Math.random() + "\0";
23014
+ var escComma = "\0COMMA" + Math.random() + "\0";
23015
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
23016
+ function numeric(str) {
23017
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
23018
+ }
23019
+ function escapeBraces(str) {
23020
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
23021
+ }
23022
+ function unescapeBraces(str) {
23023
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
23024
+ }
23025
+ function parseCommaParts(str) {
23026
+ if (!str)
23027
+ return [""];
23028
+ var parts = [];
23029
+ var m = balanced("{", "}", str);
23030
+ if (!m)
23031
+ return str.split(",");
23032
+ var pre = m.pre;
23033
+ var body = m.body;
23034
+ var post = m.post;
23035
+ var p = pre.split(",");
23036
+ p[p.length - 1] += "{" + body + "}";
23037
+ var postParts = parseCommaParts(post);
23038
+ if (post.length) {
23039
+ p[p.length - 1] += postParts.shift();
23040
+ p.push.apply(p, postParts);
23041
+ }
23042
+ parts.push.apply(parts, p);
23043
+ return parts;
23044
+ }
23045
+ function expandTop(str) {
23046
+ if (!str)
23047
+ return [];
23048
+ if (str.substr(0, 2) === "{}") {
23049
+ str = "\\{\\}" + str.substr(2);
23050
+ }
23051
+ return expand(escapeBraces(str), true).map(unescapeBraces);
23052
+ }
23053
+ function embrace(str) {
23054
+ return "{" + str + "}";
23055
+ }
23056
+ function isPadded(el) {
23057
+ return /^-?0\d/.test(el);
23058
+ }
23059
+ function lte(i, y) {
23060
+ return i <= y;
23061
+ }
23062
+ function gte(i, y) {
23063
+ return i >= y;
23064
+ }
23065
+ function expand(str, isTop) {
23066
+ var expansions = [];
23067
+ var m = balanced("{", "}", str);
23068
+ if (!m)
23069
+ return [str];
23070
+ var pre = m.pre;
23071
+ var post = m.post.length ? expand(m.post, false) : [""];
23072
+ if (/\$$/.test(m.pre)) {
23073
+ for (var k = 0; k < post.length; k++) {
23074
+ var expansion = pre + "{" + m.body + "}" + post[k];
23075
+ expansions.push(expansion);
23076
+ }
23077
+ } else {
23078
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
23079
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
23080
+ var isSequence = isNumericSequence || isAlphaSequence;
23081
+ var isOptions = m.body.indexOf(",") >= 0;
23082
+ if (!isSequence && !isOptions) {
23083
+ if (m.post.match(/,.*\}/)) {
23084
+ str = m.pre + "{" + m.body + escClose + m.post;
23085
+ return expand(str);
23086
+ }
23087
+ return [str];
23088
+ }
23089
+ var n;
23090
+ if (isSequence) {
23091
+ n = m.body.split(/\.\./);
23092
+ } else {
23093
+ n = parseCommaParts(m.body);
23094
+ if (n.length === 1) {
23095
+ n = expand(n[0], false).map(embrace);
23096
+ if (n.length === 1) {
23097
+ return post.map(function(p) {
23098
+ return m.pre + n[0] + p;
23099
+ });
23100
+ }
23101
+ }
23102
+ }
23103
+ var N;
23104
+ if (isSequence) {
23105
+ var x = numeric(n[0]);
23106
+ var y = numeric(n[1]);
23107
+ var width = Math.max(n[0].length, n[1].length);
23108
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
23109
+ var test = lte;
23110
+ var reverse = y < x;
23111
+ if (reverse) {
23112
+ incr *= -1;
23113
+ test = gte;
23114
+ }
23115
+ var pad = n.some(isPadded);
23116
+ N = [];
23117
+ for (var i = x; test(i, y); i += incr) {
23118
+ var c;
23119
+ if (isAlphaSequence) {
23120
+ c = String.fromCharCode(i);
23121
+ if (c === "\\")
23122
+ c = "";
23123
+ } else {
23124
+ c = String(i);
23125
+ if (pad) {
23126
+ var need = width - c.length;
23127
+ if (need > 0) {
23128
+ var z2 = new Array(need + 1).join("0");
23129
+ if (i < 0)
23130
+ c = "-" + z2 + c.slice(1);
23131
+ else
23132
+ c = z2 + c;
23133
+ }
23134
+ }
23135
+ }
23136
+ N.push(c);
23137
+ }
23138
+ } else {
23139
+ N = [];
23140
+ for (var j = 0; j < n.length; j++) {
23141
+ N.push.apply(N, expand(n[j], false));
23142
+ }
23143
+ }
23144
+ for (var j = 0; j < N.length; j++) {
23145
+ for (var k = 0; k < post.length; k++) {
23146
+ var expansion = pre + N[j] + post[k];
23147
+ if (!isTop || isSequence || expansion)
23148
+ expansions.push(expansion);
23149
+ }
23150
+ }
23151
+ }
23152
+ return expansions;
23153
+ }
23154
+ }
23155
+ });
23156
+
23157
+ // node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js
23158
+ var require_minimatch = __commonJS({
23159
+ "node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports, module2) {
23160
+ var minimatch = module2.exports = (p, pattern, options = {}) => {
23161
+ assertValidPattern(pattern);
23162
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23163
+ return false;
23164
+ }
23165
+ return new Minimatch(pattern, options).match(p);
23166
+ };
23167
+ module2.exports = minimatch;
23168
+ var path2 = require_path();
23169
+ minimatch.sep = path2.sep;
23170
+ var GLOBSTAR = Symbol("globstar **");
23171
+ minimatch.GLOBSTAR = GLOBSTAR;
23172
+ var expand = require_brace_expansion();
23173
+ var plTypes = {
23174
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
23175
+ "?": { open: "(?:", close: ")?" },
23176
+ "+": { open: "(?:", close: ")+" },
23177
+ "*": { open: "(?:", close: ")*" },
23178
+ "@": { open: "(?:", close: ")" }
23179
+ };
23180
+ var qmark = "[^/]";
23181
+ var star = qmark + "*?";
23182
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
23183
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
23184
+ var charSet = (s) => s.split("").reduce((set, c) => {
23185
+ set[c] = true;
23186
+ return set;
23187
+ }, {});
23188
+ var reSpecials = charSet("().*{}+?[]^$\\!");
23189
+ var addPatternStartSet = charSet("[.(");
23190
+ var slashSplit = /\/+/;
23191
+ minimatch.filter = (pattern, options = {}) => (p, i, list) => minimatch(p, pattern, options);
23192
+ var ext = (a, b = {}) => {
23193
+ const t = {};
23194
+ Object.keys(a).forEach((k) => t[k] = a[k]);
23195
+ Object.keys(b).forEach((k) => t[k] = b[k]);
23196
+ return t;
23197
+ };
23198
+ minimatch.defaults = (def) => {
23199
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
23200
+ return minimatch;
23201
+ }
23202
+ const orig = minimatch;
23203
+ const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
23204
+ m.Minimatch = class Minimatch extends orig.Minimatch {
23205
+ constructor(pattern, options) {
23206
+ super(pattern, ext(def, options));
23207
+ }
23208
+ };
23209
+ m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
23210
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
23211
+ m.defaults = (options) => orig.defaults(ext(def, options));
23212
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
23213
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
23214
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
23215
+ return m;
23216
+ };
23217
+ minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
23218
+ var braceExpand = (pattern, options = {}) => {
23219
+ assertValidPattern(pattern);
23220
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
23221
+ return [pattern];
23222
+ }
23223
+ return expand(pattern);
23224
+ };
23225
+ var MAX_PATTERN_LENGTH = 1024 * 64;
23226
+ var assertValidPattern = (pattern) => {
23227
+ if (typeof pattern !== "string") {
23228
+ throw new TypeError("invalid pattern");
23229
+ }
23230
+ if (pattern.length > MAX_PATTERN_LENGTH) {
23231
+ throw new TypeError("pattern is too long");
23232
+ }
23233
+ };
23234
+ var SUBPARSE = Symbol("subparse");
23235
+ minimatch.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
23236
+ minimatch.match = (list, pattern, options = {}) => {
23237
+ const mm = new Minimatch(pattern, options);
23238
+ list = list.filter((f) => mm.match(f));
23239
+ if (mm.options.nonull && !list.length) {
23240
+ list.push(pattern);
23241
+ }
23242
+ return list;
23243
+ };
23244
+ var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
23245
+ var charUnescape = (s) => s.replace(/\\([^-\]])/g, "$1");
23246
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
23247
+ var braExpEscape = (s) => s.replace(/[[\]\\]/g, "\\$&");
23248
+ var Minimatch = class {
23249
+ constructor(pattern, options) {
23250
+ assertValidPattern(pattern);
23251
+ if (!options)
23252
+ options = {};
23253
+ this.options = options;
23254
+ this.set = [];
23255
+ this.pattern = pattern;
23256
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
23257
+ if (this.windowsPathsNoEscape) {
23258
+ this.pattern = this.pattern.replace(/\\/g, "/");
23259
+ }
23260
+ this.regexp = null;
23261
+ this.negate = false;
23262
+ this.comment = false;
23263
+ this.empty = false;
23264
+ this.partial = !!options.partial;
23265
+ this.make();
23266
+ }
23267
+ debug() {
23268
+ }
23269
+ make() {
23270
+ const pattern = this.pattern;
23271
+ const options = this.options;
23272
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23273
+ this.comment = true;
23274
+ return;
23275
+ }
23276
+ if (!pattern) {
23277
+ this.empty = true;
23278
+ return;
23279
+ }
23280
+ this.parseNegate();
23281
+ let set = this.globSet = this.braceExpand();
23282
+ if (options.debug)
23283
+ this.debug = (...args) => console.error(...args);
23284
+ this.debug(this.pattern, set);
23285
+ set = this.globParts = set.map((s) => s.split(slashSplit));
23286
+ this.debug(this.pattern, set);
23287
+ set = set.map((s, si, set2) => s.map(this.parse, this));
23288
+ this.debug(this.pattern, set);
23289
+ set = set.filter((s) => s.indexOf(false) === -1);
23290
+ this.debug(this.pattern, set);
23291
+ this.set = set;
23292
+ }
23293
+ parseNegate() {
23294
+ if (this.options.nonegate)
23295
+ return;
23296
+ const pattern = this.pattern;
23297
+ let negate = false;
23298
+ let negateOffset = 0;
23299
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
23300
+ negate = !negate;
23301
+ negateOffset++;
23302
+ }
23303
+ if (negateOffset)
23304
+ this.pattern = pattern.slice(negateOffset);
23305
+ this.negate = negate;
23306
+ }
23307
+ matchOne(file, pattern, partial) {
23308
+ var options = this.options;
23309
+ this.debug(
23310
+ "matchOne",
23311
+ { "this": this, file, pattern }
23312
+ );
23313
+ this.debug("matchOne", file.length, pattern.length);
23314
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
23315
+ this.debug("matchOne loop");
23316
+ var p = pattern[pi];
23317
+ var f = file[fi];
23318
+ this.debug(pattern, p, f);
23319
+ if (p === false)
23320
+ return false;
23321
+ if (p === GLOBSTAR) {
23322
+ this.debug("GLOBSTAR", [pattern, p, f]);
23323
+ var fr = fi;
23324
+ var pr = pi + 1;
23325
+ if (pr === pl) {
23326
+ this.debug("** at the end");
23327
+ for (; fi < fl; fi++) {
23328
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
23329
+ return false;
23330
+ }
23331
+ return true;
23332
+ }
23333
+ while (fr < fl) {
23334
+ var swallowee = file[fr];
23335
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
23336
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
23337
+ this.debug("globstar found match!", fr, fl, swallowee);
23338
+ return true;
23339
+ } else {
23340
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
23341
+ this.debug("dot detected!", file, fr, pattern, pr);
23342
+ break;
23343
+ }
23344
+ this.debug("globstar swallow a segment, and continue");
23345
+ fr++;
23346
+ }
23347
+ }
23348
+ if (partial) {
23349
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
23350
+ if (fr === fl)
23351
+ return true;
23352
+ }
23353
+ return false;
23354
+ }
23355
+ var hit;
23356
+ if (typeof p === "string") {
23357
+ hit = f === p;
23358
+ this.debug("string match", p, f, hit);
23359
+ } else {
23360
+ hit = f.match(p);
23361
+ this.debug("pattern match", p, f, hit);
23362
+ }
23363
+ if (!hit)
23364
+ return false;
23365
+ }
23366
+ if (fi === fl && pi === pl) {
23367
+ return true;
23368
+ } else if (fi === fl) {
23369
+ return partial;
23370
+ } else if (pi === pl) {
23371
+ return fi === fl - 1 && file[fi] === "";
23372
+ }
23373
+ throw new Error("wtf?");
23374
+ }
23375
+ braceExpand() {
23376
+ return braceExpand(this.pattern, this.options);
23377
+ }
23378
+ parse(pattern, isSub) {
23379
+ assertValidPattern(pattern);
23380
+ const options = this.options;
23381
+ if (pattern === "**") {
23382
+ if (!options.noglobstar)
23383
+ return GLOBSTAR;
23384
+ else
23385
+ pattern = "*";
23386
+ }
23387
+ if (pattern === "")
23388
+ return "";
23389
+ let re = "";
23390
+ let hasMagic = false;
23391
+ let escaping = false;
23392
+ const patternListStack = [];
23393
+ const negativeLists = [];
23394
+ let stateChar;
23395
+ let inClass = false;
23396
+ let reClassStart = -1;
23397
+ let classStart = -1;
23398
+ let cs;
23399
+ let pl;
23400
+ let sp;
23401
+ let dotTravAllowed = pattern.charAt(0) === ".";
23402
+ let dotFileAllowed = options.dot || dotTravAllowed;
23403
+ const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23404
+ const subPatternStart = (p) => p.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23405
+ const clearStateChar = () => {
23406
+ if (stateChar) {
23407
+ switch (stateChar) {
23408
+ case "*":
23409
+ re += star;
23410
+ hasMagic = true;
23411
+ break;
23412
+ case "?":
23413
+ re += qmark;
23414
+ hasMagic = true;
23415
+ break;
23416
+ default:
23417
+ re += "\\" + stateChar;
23418
+ break;
23419
+ }
23420
+ this.debug("clearStateChar %j %j", stateChar, re);
23421
+ stateChar = false;
23422
+ }
23423
+ };
23424
+ for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
23425
+ this.debug("%s %s %s %j", pattern, i, re, c);
23426
+ if (escaping) {
23427
+ if (c === "/") {
23428
+ return false;
23429
+ }
23430
+ if (reSpecials[c]) {
23431
+ re += "\\";
23432
+ }
23433
+ re += c;
23434
+ escaping = false;
23435
+ continue;
23436
+ }
23437
+ switch (c) {
23438
+ case "/": {
23439
+ return false;
23440
+ }
23441
+ case "\\":
23442
+ if (inClass && pattern.charAt(i + 1) === "-") {
23443
+ re += c;
23444
+ continue;
23445
+ }
23446
+ clearStateChar();
23447
+ escaping = true;
23448
+ continue;
23449
+ case "?":
23450
+ case "*":
23451
+ case "+":
23452
+ case "@":
23453
+ case "!":
23454
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
23455
+ if (inClass) {
23456
+ this.debug(" in class");
23457
+ if (c === "!" && i === classStart + 1)
23458
+ c = "^";
23459
+ re += c;
23460
+ continue;
23461
+ }
23462
+ this.debug("call clearStateChar %j", stateChar);
23463
+ clearStateChar();
23464
+ stateChar = c;
23465
+ if (options.noext)
23466
+ clearStateChar();
23467
+ continue;
23468
+ case "(": {
23469
+ if (inClass) {
23470
+ re += "(";
23471
+ continue;
23472
+ }
23473
+ if (!stateChar) {
23474
+ re += "\\(";
23475
+ continue;
23476
+ }
23477
+ const plEntry = {
23478
+ type: stateChar,
23479
+ start: i - 1,
23480
+ reStart: re.length,
23481
+ open: plTypes[stateChar].open,
23482
+ close: plTypes[stateChar].close
23483
+ };
23484
+ this.debug(this.pattern, " ", plEntry);
23485
+ patternListStack.push(plEntry);
23486
+ re += plEntry.open;
23487
+ if (plEntry.start === 0 && plEntry.type !== "!") {
23488
+ dotTravAllowed = true;
23489
+ re += subPatternStart(pattern.slice(i + 1));
23490
+ }
23491
+ this.debug("plType %j %j", stateChar, re);
23492
+ stateChar = false;
23493
+ continue;
23494
+ }
23495
+ case ")": {
23496
+ const plEntry = patternListStack[patternListStack.length - 1];
23497
+ if (inClass || !plEntry) {
23498
+ re += "\\)";
23499
+ continue;
23500
+ }
23501
+ patternListStack.pop();
23502
+ clearStateChar();
23503
+ hasMagic = true;
23504
+ pl = plEntry;
23505
+ re += pl.close;
23506
+ if (pl.type === "!") {
23507
+ negativeLists.push(Object.assign(pl, { reEnd: re.length }));
23508
+ }
23509
+ continue;
23510
+ }
23511
+ case "|": {
23512
+ const plEntry = patternListStack[patternListStack.length - 1];
23513
+ if (inClass || !plEntry) {
23514
+ re += "\\|";
23515
+ continue;
23516
+ }
23517
+ clearStateChar();
23518
+ re += "|";
23519
+ if (plEntry.start === 0 && plEntry.type !== "!") {
23520
+ dotTravAllowed = true;
23521
+ re += subPatternStart(pattern.slice(i + 1));
23522
+ }
23523
+ continue;
23524
+ }
23525
+ case "[":
23526
+ clearStateChar();
23527
+ if (inClass) {
23528
+ re += "\\" + c;
23529
+ continue;
23530
+ }
23531
+ inClass = true;
23532
+ classStart = i;
23533
+ reClassStart = re.length;
23534
+ re += c;
23535
+ continue;
23536
+ case "]":
23537
+ if (i === classStart + 1 || !inClass) {
23538
+ re += "\\" + c;
23539
+ continue;
23540
+ }
23541
+ cs = pattern.substring(classStart + 1, i);
23542
+ try {
23543
+ RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
23544
+ re += c;
23545
+ } catch (er) {
23546
+ re = re.substring(0, reClassStart) + "(?:$.)";
23547
+ }
23548
+ hasMagic = true;
23549
+ inClass = false;
23550
+ continue;
23551
+ default:
23552
+ clearStateChar();
23553
+ if (reSpecials[c] && !(c === "^" && inClass)) {
23554
+ re += "\\";
23555
+ }
23556
+ re += c;
23557
+ break;
23558
+ }
23559
+ }
23560
+ if (inClass) {
23561
+ cs = pattern.slice(classStart + 1);
23562
+ sp = this.parse(cs, SUBPARSE);
23563
+ re = re.substring(0, reClassStart) + "\\[" + sp[0];
23564
+ hasMagic = hasMagic || sp[1];
23565
+ }
23566
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
23567
+ let tail;
23568
+ tail = re.slice(pl.reStart + pl.open.length);
23569
+ this.debug("setting tail", re, pl);
23570
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
23571
+ if (!$2) {
23572
+ $2 = "\\";
23573
+ }
23574
+ return $1 + $1 + $2 + "|";
23575
+ });
23576
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
23577
+ const t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
23578
+ hasMagic = true;
23579
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
23580
+ }
23581
+ clearStateChar();
23582
+ if (escaping) {
23583
+ re += "\\\\";
23584
+ }
23585
+ const addPatternStart = addPatternStartSet[re.charAt(0)];
23586
+ for (let n = negativeLists.length - 1; n > -1; n--) {
23587
+ const nl = negativeLists[n];
23588
+ const nlBefore = re.slice(0, nl.reStart);
23589
+ const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
23590
+ let nlAfter = re.slice(nl.reEnd);
23591
+ const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
23592
+ const closeParensBefore = nlBefore.split(")").length;
23593
+ const openParensBefore = nlBefore.split("(").length - closeParensBefore;
23594
+ let cleanAfter = nlAfter;
23595
+ for (let i = 0; i < openParensBefore; i++) {
23596
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
23597
+ }
23598
+ nlAfter = cleanAfter;
23599
+ const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
23600
+ re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
23601
+ }
23602
+ if (re !== "" && hasMagic) {
23603
+ re = "(?=.)" + re;
23604
+ }
23605
+ if (addPatternStart) {
23606
+ re = patternStart() + re;
23607
+ }
23608
+ if (isSub === SUBPARSE) {
23609
+ return [re, hasMagic];
23610
+ }
23611
+ if (options.nocase && !hasMagic) {
23612
+ hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
23613
+ }
23614
+ if (!hasMagic) {
23615
+ return globUnescape(pattern);
23616
+ }
23617
+ const flags = options.nocase ? "i" : "";
23618
+ try {
23619
+ return Object.assign(new RegExp("^" + re + "$", flags), {
23620
+ _glob: pattern,
23621
+ _src: re
23622
+ });
23623
+ } catch (er) {
23624
+ return new RegExp("$.");
23625
+ }
23626
+ }
23627
+ makeRe() {
23628
+ if (this.regexp || this.regexp === false)
23629
+ return this.regexp;
23630
+ const set = this.set;
23631
+ if (!set.length) {
23632
+ this.regexp = false;
23633
+ return this.regexp;
23634
+ }
23635
+ const options = this.options;
23636
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
23637
+ const flags = options.nocase ? "i" : "";
23638
+ let re = set.map((pattern) => {
23639
+ pattern = pattern.map(
23640
+ (p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src
23641
+ ).reduce((set2, p) => {
23642
+ if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
23643
+ set2.push(p);
23644
+ }
23645
+ return set2;
23646
+ }, []);
23647
+ pattern.forEach((p, i) => {
23648
+ if (p !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) {
23649
+ return;
23650
+ }
23651
+ if (i === 0) {
23652
+ if (pattern.length > 1) {
23653
+ pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
23654
+ } else {
23655
+ pattern[i] = twoStar;
23656
+ }
23657
+ } else if (i === pattern.length - 1) {
23658
+ pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
23659
+ } else {
23660
+ pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
23661
+ pattern[i + 1] = GLOBSTAR;
23662
+ }
23663
+ });
23664
+ return pattern.filter((p) => p !== GLOBSTAR).join("/");
23665
+ }).join("|");
23666
+ re = "^(?:" + re + ")$";
23667
+ if (this.negate)
23668
+ re = "^(?!" + re + ").*$";
23669
+ try {
23670
+ this.regexp = new RegExp(re, flags);
23671
+ } catch (ex) {
23672
+ this.regexp = false;
23673
+ }
23674
+ return this.regexp;
23675
+ }
23676
+ match(f, partial = this.partial) {
23677
+ this.debug("match", f, this.pattern);
23678
+ if (this.comment)
23679
+ return false;
23680
+ if (this.empty)
23681
+ return f === "";
23682
+ if (f === "/" && partial)
23683
+ return true;
23684
+ const options = this.options;
23685
+ if (path2.sep !== "/") {
23686
+ f = f.split(path2.sep).join("/");
23687
+ }
23688
+ f = f.split(slashSplit);
23689
+ this.debug(this.pattern, "split", f);
23690
+ const set = this.set;
23691
+ this.debug(this.pattern, "set", set);
23692
+ let filename;
23693
+ for (let i = f.length - 1; i >= 0; i--) {
23694
+ filename = f[i];
23695
+ if (filename)
23696
+ break;
23697
+ }
23698
+ for (let i = 0; i < set.length; i++) {
23699
+ const pattern = set[i];
23700
+ let file = f;
23701
+ if (options.matchBase && pattern.length === 1) {
23702
+ file = [filename];
23703
+ }
23704
+ const hit = this.matchOne(file, pattern, partial);
23705
+ if (hit) {
23706
+ if (options.flipNegate)
23707
+ return true;
23708
+ return !this.negate;
23709
+ }
23710
+ }
23711
+ if (options.flipNegate)
23712
+ return false;
23713
+ return this.negate;
23714
+ }
23715
+ static defaults(def) {
23716
+ return minimatch.defaults(def).Minimatch;
23717
+ }
23718
+ };
23719
+ minimatch.Minimatch = Minimatch;
23720
+ }
23721
+ });
23722
+
23723
+ // node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
23724
+ var require_inherits_browser = __commonJS({
23725
+ "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module2) {
23726
+ if (typeof Object.create === "function") {
23727
+ module2.exports = function inherits(ctor, superCtor) {
23728
+ if (superCtor) {
23729
+ ctor.super_ = superCtor;
23730
+ ctor.prototype = Object.create(superCtor.prototype, {
23731
+ constructor: {
23732
+ value: ctor,
23733
+ enumerable: false,
23734
+ writable: true,
23735
+ configurable: true
23736
+ }
23737
+ });
23738
+ }
23739
+ };
23740
+ } else {
23741
+ module2.exports = function inherits(ctor, superCtor) {
23742
+ if (superCtor) {
23743
+ ctor.super_ = superCtor;
23744
+ var TempCtor = function() {
23745
+ };
23746
+ TempCtor.prototype = superCtor.prototype;
23747
+ ctor.prototype = new TempCtor();
23748
+ ctor.prototype.constructor = ctor;
23749
+ }
23750
+ };
23751
+ }
23752
+ }
23753
+ });
23754
+
23755
+ // node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
23756
+ var require_inherits = __commonJS({
23757
+ "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js"(exports, module2) {
23758
+ try {
23759
+ util2 = require("util");
23760
+ if (typeof util2.inherits !== "function")
23761
+ throw "";
23762
+ module2.exports = util2.inherits;
23763
+ } catch (e) {
23764
+ module2.exports = require_inherits_browser();
23765
+ }
23766
+ var util2;
23767
+ }
23768
+ });
23769
+
23770
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/common.js
23771
+ var require_common2 = __commonJS({
23772
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/common.js"(exports) {
23773
+ exports.setopts = setopts;
23774
+ exports.ownProp = ownProp;
23775
+ exports.makeAbs = makeAbs;
23776
+ exports.finish = finish;
23777
+ exports.mark = mark;
23778
+ exports.isIgnored = isIgnored;
23779
+ exports.childrenIgnored = childrenIgnored;
23780
+ function ownProp(obj, field) {
23781
+ return Object.prototype.hasOwnProperty.call(obj, field);
23782
+ }
23783
+ var fs7 = require("fs");
23784
+ var path2 = require("path");
23785
+ var minimatch = require_minimatch();
23786
+ var isAbsolute = require("path").isAbsolute;
23787
+ var Minimatch = minimatch.Minimatch;
23788
+ function alphasort(a, b) {
23789
+ return a.localeCompare(b, "en");
23790
+ }
23791
+ function setupIgnores(self2, options) {
23792
+ self2.ignore = options.ignore || [];
23793
+ if (!Array.isArray(self2.ignore))
23794
+ self2.ignore = [self2.ignore];
23795
+ if (self2.ignore.length) {
23796
+ self2.ignore = self2.ignore.map(ignoreMap);
23797
+ }
23798
+ }
23799
+ function ignoreMap(pattern) {
23800
+ var gmatcher = null;
23801
+ if (pattern.slice(-3) === "/**") {
23802
+ var gpattern = pattern.replace(/(\/\*\*)+$/, "");
23803
+ gmatcher = new Minimatch(gpattern, { dot: true });
23804
+ }
23805
+ return {
23806
+ matcher: new Minimatch(pattern, { dot: true }),
23807
+ gmatcher
23808
+ };
23809
+ }
23810
+ function setopts(self2, pattern, options) {
23811
+ if (!options)
23812
+ options = {};
23813
+ if (options.matchBase && -1 === pattern.indexOf("/")) {
23814
+ if (options.noglobstar) {
23815
+ throw new Error("base matching requires globstar");
23816
+ }
23817
+ pattern = "**/" + pattern;
23818
+ }
23819
+ self2.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
23820
+ if (self2.windowsPathsNoEscape) {
23821
+ pattern = pattern.replace(/\\/g, "/");
23822
+ }
23823
+ self2.silent = !!options.silent;
23824
+ self2.pattern = pattern;
23825
+ self2.strict = options.strict !== false;
23826
+ self2.realpath = !!options.realpath;
23827
+ self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
23828
+ self2.follow = !!options.follow;
23829
+ self2.dot = !!options.dot;
23830
+ self2.mark = !!options.mark;
23831
+ self2.nodir = !!options.nodir;
23832
+ if (self2.nodir)
23833
+ self2.mark = true;
23834
+ self2.sync = !!options.sync;
23835
+ self2.nounique = !!options.nounique;
23836
+ self2.nonull = !!options.nonull;
23837
+ self2.nosort = !!options.nosort;
23838
+ self2.nocase = !!options.nocase;
23839
+ self2.stat = !!options.stat;
23840
+ self2.noprocess = !!options.noprocess;
23841
+ self2.absolute = !!options.absolute;
23842
+ self2.fs = options.fs || fs7;
23843
+ self2.maxLength = options.maxLength || Infinity;
23844
+ self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
23845
+ self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
23846
+ self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
23847
+ setupIgnores(self2, options);
23848
+ self2.changedCwd = false;
23849
+ var cwd = process.cwd();
23850
+ if (!ownProp(options, "cwd"))
23851
+ self2.cwd = path2.resolve(cwd);
23852
+ else {
23853
+ self2.cwd = path2.resolve(options.cwd);
23854
+ self2.changedCwd = self2.cwd !== cwd;
23855
+ }
23856
+ self2.root = options.root || path2.resolve(self2.cwd, "/");
23857
+ self2.root = path2.resolve(self2.root);
23858
+ self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
23859
+ self2.nomount = !!options.nomount;
23860
+ if (process.platform === "win32") {
23861
+ self2.root = self2.root.replace(/\\/g, "/");
23862
+ self2.cwd = self2.cwd.replace(/\\/g, "/");
23863
+ self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
23864
+ }
23865
+ options.nonegate = true;
23866
+ options.nocomment = true;
23867
+ self2.minimatch = new Minimatch(pattern, options);
23868
+ self2.options = self2.minimatch.options;
23869
+ }
23870
+ function finish(self2) {
23871
+ var nou = self2.nounique;
23872
+ var all = nou ? [] : /* @__PURE__ */ Object.create(null);
23873
+ for (var i = 0, l = self2.matches.length; i < l; i++) {
23874
+ var matches = self2.matches[i];
23875
+ if (!matches || Object.keys(matches).length === 0) {
23876
+ if (self2.nonull) {
23877
+ var literal = self2.minimatch.globSet[i];
23878
+ if (nou)
23879
+ all.push(literal);
23880
+ else
23881
+ all[literal] = true;
23882
+ }
23883
+ } else {
23884
+ var m = Object.keys(matches);
23885
+ if (nou)
23886
+ all.push.apply(all, m);
23887
+ else
23888
+ m.forEach(function(m2) {
23889
+ all[m2] = true;
23890
+ });
23891
+ }
23892
+ }
23893
+ if (!nou)
23894
+ all = Object.keys(all);
23895
+ if (!self2.nosort)
23896
+ all = all.sort(alphasort);
23897
+ if (self2.mark) {
23898
+ for (var i = 0; i < all.length; i++) {
23899
+ all[i] = self2._mark(all[i]);
23900
+ }
23901
+ if (self2.nodir) {
23902
+ all = all.filter(function(e) {
23903
+ var notDir = !/\/$/.test(e);
23904
+ var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
23905
+ if (notDir && c)
23906
+ notDir = c !== "DIR" && !Array.isArray(c);
23907
+ return notDir;
23908
+ });
23909
+ }
23910
+ }
23911
+ if (self2.ignore.length)
23912
+ all = all.filter(function(m2) {
23913
+ return !isIgnored(self2, m2);
23914
+ });
23915
+ self2.found = all;
23916
+ }
23917
+ function mark(self2, p) {
23918
+ var abs = makeAbs(self2, p);
23919
+ var c = self2.cache[abs];
23920
+ var m = p;
23921
+ if (c) {
23922
+ var isDir = c === "DIR" || Array.isArray(c);
23923
+ var slash = p.slice(-1) === "/";
23924
+ if (isDir && !slash)
23925
+ m += "/";
23926
+ else if (!isDir && slash)
23927
+ m = m.slice(0, -1);
23928
+ if (m !== p) {
23929
+ var mabs = makeAbs(self2, m);
23930
+ self2.statCache[mabs] = self2.statCache[abs];
23931
+ self2.cache[mabs] = self2.cache[abs];
23932
+ }
23933
+ }
23934
+ return m;
23935
+ }
23936
+ function makeAbs(self2, f) {
23937
+ var abs = f;
23938
+ if (f.charAt(0) === "/") {
23939
+ abs = path2.join(self2.root, f);
23940
+ } else if (isAbsolute(f) || f === "") {
23941
+ abs = f;
23942
+ } else if (self2.changedCwd) {
23943
+ abs = path2.resolve(self2.cwd, f);
23944
+ } else {
23945
+ abs = path2.resolve(f);
23946
+ }
23947
+ if (process.platform === "win32")
23948
+ abs = abs.replace(/\\/g, "/");
23949
+ return abs;
23950
+ }
23951
+ function isIgnored(self2, path3) {
23952
+ if (!self2.ignore.length)
23953
+ return false;
23954
+ return self2.ignore.some(function(item) {
23955
+ return item.matcher.match(path3) || !!(item.gmatcher && item.gmatcher.match(path3));
23956
+ });
23957
+ }
23958
+ function childrenIgnored(self2, path3) {
23959
+ if (!self2.ignore.length)
23960
+ return false;
23961
+ return self2.ignore.some(function(item) {
23962
+ return !!(item.gmatcher && item.gmatcher.match(path3));
23963
+ });
23964
+ }
23965
+ }
23966
+ });
23967
+
23968
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/sync.js
23969
+ var require_sync = __commonJS({
23970
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/sync.js"(exports, module2) {
23971
+ module2.exports = globSync;
23972
+ globSync.GlobSync = GlobSync;
23973
+ var rp = require_fs();
23974
+ var minimatch = require_minimatch();
23975
+ var Minimatch = minimatch.Minimatch;
23976
+ var Glob = require_glob().Glob;
23977
+ var util2 = require("util");
23978
+ var path2 = require("path");
23979
+ var assert = require("assert");
23980
+ var isAbsolute = require("path").isAbsolute;
23981
+ var common = require_common2();
23982
+ var setopts = common.setopts;
23983
+ var ownProp = common.ownProp;
23984
+ var childrenIgnored = common.childrenIgnored;
23985
+ var isIgnored = common.isIgnored;
23986
+ function globSync(pattern, options) {
23987
+ if (typeof options === "function" || arguments.length === 3)
23988
+ throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
23989
+ return new GlobSync(pattern, options).found;
23990
+ }
23991
+ function GlobSync(pattern, options) {
23992
+ if (!pattern)
23993
+ throw new Error("must provide pattern");
23994
+ if (typeof options === "function" || arguments.length === 3)
23995
+ throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
23996
+ if (!(this instanceof GlobSync))
23997
+ return new GlobSync(pattern, options);
23998
+ setopts(this, pattern, options);
23999
+ if (this.noprocess)
24000
+ return this;
24001
+ var n = this.minimatch.set.length;
24002
+ this.matches = new Array(n);
24003
+ for (var i = 0; i < n; i++) {
24004
+ this._process(this.minimatch.set[i], i, false);
24005
+ }
24006
+ this._finish();
24007
+ }
24008
+ GlobSync.prototype._finish = function() {
24009
+ assert.ok(this instanceof GlobSync);
24010
+ if (this.realpath) {
24011
+ var self2 = this;
24012
+ this.matches.forEach(function(matchset, index4) {
24013
+ var set = self2.matches[index4] = /* @__PURE__ */ Object.create(null);
24014
+ for (var p in matchset) {
24015
+ try {
24016
+ p = self2._makeAbs(p);
24017
+ var real = rp.realpathSync(p, self2.realpathCache);
24018
+ set[real] = true;
24019
+ } catch (er) {
24020
+ if (er.syscall === "stat")
24021
+ set[self2._makeAbs(p)] = true;
24022
+ else
24023
+ throw er;
24024
+ }
24025
+ }
24026
+ });
24027
+ }
24028
+ common.finish(this);
24029
+ };
24030
+ GlobSync.prototype._process = function(pattern, index4, inGlobStar) {
24031
+ assert.ok(this instanceof GlobSync);
24032
+ var n = 0;
24033
+ while (typeof pattern[n] === "string") {
24034
+ n++;
24035
+ }
24036
+ var prefix;
24037
+ switch (n) {
24038
+ case pattern.length:
24039
+ this._processSimple(pattern.join("/"), index4);
24040
+ return;
24041
+ case 0:
24042
+ prefix = null;
24043
+ break;
24044
+ default:
24045
+ prefix = pattern.slice(0, n).join("/");
24046
+ break;
24047
+ }
24048
+ var remain = pattern.slice(n);
24049
+ var read;
24050
+ if (prefix === null)
24051
+ read = ".";
24052
+ else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
24053
+ return typeof p === "string" ? p : "[*]";
24054
+ }).join("/"))) {
24055
+ if (!prefix || !isAbsolute(prefix))
24056
+ prefix = "/" + prefix;
24057
+ read = prefix;
24058
+ } else
24059
+ read = prefix;
24060
+ var abs = this._makeAbs(read);
24061
+ if (childrenIgnored(this, read))
24062
+ return;
24063
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
24064
+ if (isGlobStar)
24065
+ this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar);
24066
+ else
24067
+ this._processReaddir(prefix, read, abs, remain, index4, inGlobStar);
24068
+ };
24069
+ GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar) {
24070
+ var entries = this._readdir(abs, inGlobStar);
24071
+ if (!entries)
24072
+ return;
24073
+ var pn = remain[0];
24074
+ var negate = !!this.minimatch.negate;
24075
+ var rawGlob = pn._glob;
24076
+ var dotOk = this.dot || rawGlob.charAt(0) === ".";
24077
+ var matchedEntries = [];
24078
+ for (var i = 0; i < entries.length; i++) {
24079
+ var e = entries[i];
24080
+ if (e.charAt(0) !== "." || dotOk) {
24081
+ var m;
24082
+ if (negate && !prefix) {
24083
+ m = !e.match(pn);
24084
+ } else {
24085
+ m = e.match(pn);
24086
+ }
24087
+ if (m)
24088
+ matchedEntries.push(e);
24089
+ }
24090
+ }
24091
+ var len = matchedEntries.length;
24092
+ if (len === 0)
24093
+ return;
24094
+ if (remain.length === 1 && !this.mark && !this.stat) {
24095
+ if (!this.matches[index4])
24096
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24097
+ for (var i = 0; i < len; i++) {
24098
+ var e = matchedEntries[i];
24099
+ if (prefix) {
24100
+ if (prefix.slice(-1) !== "/")
24101
+ e = prefix + "/" + e;
24102
+ else
24103
+ e = prefix + e;
24104
+ }
24105
+ if (e.charAt(0) === "/" && !this.nomount) {
24106
+ e = path2.join(this.root, e);
24107
+ }
24108
+ this._emitMatch(index4, e);
24109
+ }
24110
+ return;
24111
+ }
24112
+ remain.shift();
24113
+ for (var i = 0; i < len; i++) {
24114
+ var e = matchedEntries[i];
24115
+ var newPattern;
24116
+ if (prefix)
24117
+ newPattern = [prefix, e];
24118
+ else
24119
+ newPattern = [e];
24120
+ this._process(newPattern.concat(remain), index4, inGlobStar);
24121
+ }
24122
+ };
24123
+ GlobSync.prototype._emitMatch = function(index4, e) {
24124
+ if (isIgnored(this, e))
24125
+ return;
24126
+ var abs = this._makeAbs(e);
24127
+ if (this.mark)
24128
+ e = this._mark(e);
24129
+ if (this.absolute) {
24130
+ e = abs;
24131
+ }
24132
+ if (this.matches[index4][e])
24133
+ return;
24134
+ if (this.nodir) {
24135
+ var c = this.cache[abs];
24136
+ if (c === "DIR" || Array.isArray(c))
24137
+ return;
24138
+ }
24139
+ this.matches[index4][e] = true;
24140
+ if (this.stat)
24141
+ this._stat(e);
24142
+ };
24143
+ GlobSync.prototype._readdirInGlobStar = function(abs) {
24144
+ if (this.follow)
24145
+ return this._readdir(abs, false);
24146
+ var entries;
24147
+ var lstat;
24148
+ var stat;
24149
+ try {
24150
+ lstat = this.fs.lstatSync(abs);
24151
+ } catch (er) {
24152
+ if (er.code === "ENOENT") {
24153
+ return null;
24154
+ }
24155
+ }
24156
+ var isSym = lstat && lstat.isSymbolicLink();
24157
+ this.symlinks[abs] = isSym;
24158
+ if (!isSym && lstat && !lstat.isDirectory())
24159
+ this.cache[abs] = "FILE";
24160
+ else
24161
+ entries = this._readdir(abs, false);
24162
+ return entries;
24163
+ };
24164
+ GlobSync.prototype._readdir = function(abs, inGlobStar) {
24165
+ var entries;
24166
+ if (inGlobStar && !ownProp(this.symlinks, abs))
24167
+ return this._readdirInGlobStar(abs);
24168
+ if (ownProp(this.cache, abs)) {
24169
+ var c = this.cache[abs];
24170
+ if (!c || c === "FILE")
24171
+ return null;
24172
+ if (Array.isArray(c))
24173
+ return c;
24174
+ }
24175
+ try {
24176
+ return this._readdirEntries(abs, this.fs.readdirSync(abs));
24177
+ } catch (er) {
24178
+ this._readdirError(abs, er);
24179
+ return null;
24180
+ }
24181
+ };
24182
+ GlobSync.prototype._readdirEntries = function(abs, entries) {
24183
+ if (!this.mark && !this.stat) {
24184
+ for (var i = 0; i < entries.length; i++) {
24185
+ var e = entries[i];
24186
+ if (abs === "/")
24187
+ e = abs + e;
24188
+ else
24189
+ e = abs + "/" + e;
24190
+ this.cache[e] = true;
24191
+ }
24192
+ }
24193
+ this.cache[abs] = entries;
24194
+ return entries;
24195
+ };
24196
+ GlobSync.prototype._readdirError = function(f, er) {
24197
+ switch (er.code) {
24198
+ case "ENOTSUP":
24199
+ case "ENOTDIR":
24200
+ var abs = this._makeAbs(f);
24201
+ this.cache[abs] = "FILE";
24202
+ if (abs === this.cwdAbs) {
24203
+ var error2 = new Error(er.code + " invalid cwd " + this.cwd);
24204
+ error2.path = this.cwd;
24205
+ error2.code = er.code;
24206
+ throw error2;
24207
+ }
24208
+ break;
24209
+ case "ENOENT":
24210
+ case "ELOOP":
24211
+ case "ENAMETOOLONG":
24212
+ case "UNKNOWN":
24213
+ this.cache[this._makeAbs(f)] = false;
24214
+ break;
24215
+ default:
24216
+ this.cache[this._makeAbs(f)] = false;
24217
+ if (this.strict)
24218
+ throw er;
24219
+ if (!this.silent)
24220
+ console.error("glob error", er);
24221
+ break;
24222
+ }
24223
+ };
24224
+ GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar) {
24225
+ var entries = this._readdir(abs, inGlobStar);
24226
+ if (!entries)
24227
+ return;
24228
+ var remainWithoutGlobStar = remain.slice(1);
24229
+ var gspref = prefix ? [prefix] : [];
24230
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
24231
+ this._process(noGlobStar, index4, false);
24232
+ var len = entries.length;
24233
+ var isSym = this.symlinks[abs];
24234
+ if (isSym && inGlobStar)
24235
+ return;
24236
+ for (var i = 0; i < len; i++) {
24237
+ var e = entries[i];
24238
+ if (e.charAt(0) === "." && !this.dot)
24239
+ continue;
24240
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
24241
+ this._process(instead, index4, true);
24242
+ var below = gspref.concat(entries[i], remain);
24243
+ this._process(below, index4, true);
24244
+ }
24245
+ };
24246
+ GlobSync.prototype._processSimple = function(prefix, index4) {
24247
+ var exists = this._stat(prefix);
24248
+ if (!this.matches[index4])
24249
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24250
+ if (!exists)
24251
+ return;
24252
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
24253
+ var trail = /[\/\\]$/.test(prefix);
24254
+ if (prefix.charAt(0) === "/") {
24255
+ prefix = path2.join(this.root, prefix);
24256
+ } else {
24257
+ prefix = path2.resolve(this.root, prefix);
24258
+ if (trail)
24259
+ prefix += "/";
24260
+ }
24261
+ }
24262
+ if (process.platform === "win32")
24263
+ prefix = prefix.replace(/\\/g, "/");
24264
+ this._emitMatch(index4, prefix);
24265
+ };
24266
+ GlobSync.prototype._stat = function(f) {
24267
+ var abs = this._makeAbs(f);
24268
+ var needDir = f.slice(-1) === "/";
24269
+ if (f.length > this.maxLength)
24270
+ return false;
24271
+ if (!this.stat && ownProp(this.cache, abs)) {
24272
+ var c = this.cache[abs];
24273
+ if (Array.isArray(c))
24274
+ c = "DIR";
24275
+ if (!needDir || c === "DIR")
24276
+ return c;
24277
+ if (needDir && c === "FILE")
24278
+ return false;
24279
+ }
24280
+ var exists;
24281
+ var stat = this.statCache[abs];
24282
+ if (!stat) {
24283
+ var lstat;
24284
+ try {
24285
+ lstat = this.fs.lstatSync(abs);
24286
+ } catch (er) {
24287
+ if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
24288
+ this.statCache[abs] = false;
24289
+ return false;
24290
+ }
24291
+ }
24292
+ if (lstat && lstat.isSymbolicLink()) {
24293
+ try {
24294
+ stat = this.fs.statSync(abs);
24295
+ } catch (er) {
24296
+ stat = lstat;
24297
+ }
24298
+ } else {
24299
+ stat = lstat;
24300
+ }
24301
+ }
24302
+ this.statCache[abs] = stat;
24303
+ var c = true;
24304
+ if (stat)
24305
+ c = stat.isDirectory() ? "DIR" : "FILE";
24306
+ this.cache[abs] = this.cache[abs] || c;
24307
+ if (needDir && c === "FILE")
24308
+ return false;
24309
+ return c;
24310
+ };
24311
+ GlobSync.prototype._mark = function(p) {
24312
+ return common.mark(this, p);
24313
+ };
24314
+ GlobSync.prototype._makeAbs = function(f) {
24315
+ return common.makeAbs(this, f);
24316
+ };
24317
+ }
24318
+ });
24319
+
24320
+ // node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
24321
+ var require_wrappy = __commonJS({
24322
+ "node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js"(exports, module2) {
24323
+ module2.exports = wrappy;
24324
+ function wrappy(fn, cb) {
24325
+ if (fn && cb)
24326
+ return wrappy(fn)(cb);
24327
+ if (typeof fn !== "function")
24328
+ throw new TypeError("need wrapper function");
24329
+ Object.keys(fn).forEach(function(k) {
24330
+ wrapper[k] = fn[k];
24331
+ });
24332
+ return wrapper;
24333
+ function wrapper() {
24334
+ var args = new Array(arguments.length);
24335
+ for (var i = 0; i < args.length; i++) {
24336
+ args[i] = arguments[i];
24337
+ }
24338
+ var ret = fn.apply(this, args);
24339
+ var cb2 = args[args.length - 1];
24340
+ if (typeof ret === "function" && ret !== cb2) {
24341
+ Object.keys(cb2).forEach(function(k) {
24342
+ ret[k] = cb2[k];
24343
+ });
24344
+ }
24345
+ return ret;
24346
+ }
24347
+ }
24348
+ }
24349
+ });
24350
+
24351
+ // node_modules/.pnpm/once@1.4.0/node_modules/once/once.js
24352
+ var require_once = __commonJS({
24353
+ "node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports, module2) {
24354
+ var wrappy = require_wrappy();
24355
+ module2.exports = wrappy(once);
24356
+ module2.exports.strict = wrappy(onceStrict);
24357
+ once.proto = once(function() {
24358
+ Object.defineProperty(Function.prototype, "once", {
24359
+ value: function() {
24360
+ return once(this);
24361
+ },
24362
+ configurable: true
24363
+ });
24364
+ Object.defineProperty(Function.prototype, "onceStrict", {
24365
+ value: function() {
24366
+ return onceStrict(this);
24367
+ },
24368
+ configurable: true
24369
+ });
24370
+ });
24371
+ function once(fn) {
24372
+ var f = function() {
24373
+ if (f.called)
24374
+ return f.value;
24375
+ f.called = true;
24376
+ return f.value = fn.apply(this, arguments);
24377
+ };
24378
+ f.called = false;
24379
+ return f;
24380
+ }
24381
+ function onceStrict(fn) {
24382
+ var f = function() {
24383
+ if (f.called)
24384
+ throw new Error(f.onceError);
24385
+ f.called = true;
24386
+ return f.value = fn.apply(this, arguments);
24387
+ };
24388
+ var name = fn.name || "Function wrapped with `once`";
24389
+ f.onceError = name + " shouldn't be called more than once";
24390
+ f.called = false;
24391
+ return f;
24392
+ }
24393
+ }
24394
+ });
24395
+
24396
+ // node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js
24397
+ var require_inflight = __commonJS({
24398
+ "node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js"(exports, module2) {
24399
+ var wrappy = require_wrappy();
24400
+ var reqs = /* @__PURE__ */ Object.create(null);
24401
+ var once = require_once();
24402
+ module2.exports = wrappy(inflight);
24403
+ function inflight(key, cb) {
24404
+ if (reqs[key]) {
24405
+ reqs[key].push(cb);
24406
+ return null;
24407
+ } else {
24408
+ reqs[key] = [cb];
24409
+ return makeres(key);
24410
+ }
24411
+ }
24412
+ function makeres(key) {
24413
+ return once(function RES() {
24414
+ var cbs = reqs[key];
24415
+ var len = cbs.length;
24416
+ var args = slice(arguments);
24417
+ try {
24418
+ for (var i = 0; i < len; i++) {
24419
+ cbs[i].apply(null, args);
24420
+ }
24421
+ } finally {
24422
+ if (cbs.length > len) {
24423
+ cbs.splice(0, len);
24424
+ process.nextTick(function() {
24425
+ RES.apply(null, args);
24426
+ });
24427
+ } else {
24428
+ delete reqs[key];
24429
+ }
24430
+ }
24431
+ });
24432
+ }
24433
+ function slice(args) {
24434
+ var length = args.length;
24435
+ var array = [];
24436
+ for (var i = 0; i < length; i++)
24437
+ array[i] = args[i];
24438
+ return array;
24439
+ }
24440
+ }
24441
+ });
24442
+
24443
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/glob.js
24444
+ var require_glob = __commonJS({
24445
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/glob.js"(exports, module2) {
24446
+ module2.exports = glob2;
24447
+ var rp = require_fs();
24448
+ var minimatch = require_minimatch();
24449
+ var Minimatch = minimatch.Minimatch;
24450
+ var inherits = require_inherits();
24451
+ var EE = require("events").EventEmitter;
24452
+ var path2 = require("path");
24453
+ var assert = require("assert");
24454
+ var isAbsolute = require("path").isAbsolute;
24455
+ var globSync = require_sync();
24456
+ var common = require_common2();
24457
+ var setopts = common.setopts;
24458
+ var ownProp = common.ownProp;
24459
+ var inflight = require_inflight();
24460
+ var util2 = require("util");
24461
+ var childrenIgnored = common.childrenIgnored;
24462
+ var isIgnored = common.isIgnored;
24463
+ var once = require_once();
24464
+ function glob2(pattern, options, cb) {
24465
+ if (typeof options === "function")
24466
+ cb = options, options = {};
24467
+ if (!options)
24468
+ options = {};
24469
+ if (options.sync) {
24470
+ if (cb)
24471
+ throw new TypeError("callback provided to sync glob");
24472
+ return globSync(pattern, options);
24473
+ }
24474
+ return new Glob(pattern, options, cb);
24475
+ }
24476
+ glob2.sync = globSync;
24477
+ var GlobSync = glob2.GlobSync = globSync.GlobSync;
24478
+ glob2.glob = glob2;
24479
+ function extend(origin, add) {
24480
+ if (add === null || typeof add !== "object") {
24481
+ return origin;
24482
+ }
24483
+ var keys = Object.keys(add);
24484
+ var i = keys.length;
24485
+ while (i--) {
24486
+ origin[keys[i]] = add[keys[i]];
24487
+ }
24488
+ return origin;
24489
+ }
24490
+ glob2.hasMagic = function(pattern, options_) {
24491
+ var options = extend({}, options_);
24492
+ options.noprocess = true;
24493
+ var g = new Glob(pattern, options);
24494
+ var set = g.minimatch.set;
24495
+ if (!pattern)
24496
+ return false;
24497
+ if (set.length > 1)
24498
+ return true;
24499
+ for (var j = 0; j < set[0].length; j++) {
24500
+ if (typeof set[0][j] !== "string")
24501
+ return true;
24502
+ }
24503
+ return false;
24504
+ };
24505
+ glob2.Glob = Glob;
24506
+ inherits(Glob, EE);
24507
+ function Glob(pattern, options, cb) {
24508
+ if (typeof options === "function") {
24509
+ cb = options;
24510
+ options = null;
24511
+ }
24512
+ if (options && options.sync) {
24513
+ if (cb)
24514
+ throw new TypeError("callback provided to sync glob");
24515
+ return new GlobSync(pattern, options);
24516
+ }
24517
+ if (!(this instanceof Glob))
24518
+ return new Glob(pattern, options, cb);
24519
+ setopts(this, pattern, options);
24520
+ this._didRealPath = false;
24521
+ var n = this.minimatch.set.length;
24522
+ this.matches = new Array(n);
24523
+ if (typeof cb === "function") {
24524
+ cb = once(cb);
24525
+ this.on("error", cb);
24526
+ this.on("end", function(matches) {
24527
+ cb(null, matches);
24528
+ });
24529
+ }
24530
+ var self2 = this;
24531
+ this._processing = 0;
24532
+ this._emitQueue = [];
24533
+ this._processQueue = [];
24534
+ this.paused = false;
24535
+ if (this.noprocess)
24536
+ return this;
24537
+ if (n === 0)
24538
+ return done();
24539
+ var sync = true;
24540
+ for (var i = 0; i < n; i++) {
24541
+ this._process(this.minimatch.set[i], i, false, done);
24542
+ }
24543
+ sync = false;
24544
+ function done() {
24545
+ --self2._processing;
24546
+ if (self2._processing <= 0) {
24547
+ if (sync) {
24548
+ process.nextTick(function() {
24549
+ self2._finish();
24550
+ });
24551
+ } else {
24552
+ self2._finish();
24553
+ }
24554
+ }
24555
+ }
24556
+ }
24557
+ Glob.prototype._finish = function() {
24558
+ assert(this instanceof Glob);
24559
+ if (this.aborted)
24560
+ return;
24561
+ if (this.realpath && !this._didRealpath)
24562
+ return this._realpath();
24563
+ common.finish(this);
24564
+ this.emit("end", this.found);
24565
+ };
24566
+ Glob.prototype._realpath = function() {
24567
+ if (this._didRealpath)
24568
+ return;
24569
+ this._didRealpath = true;
24570
+ var n = this.matches.length;
24571
+ if (n === 0)
24572
+ return this._finish();
24573
+ var self2 = this;
24574
+ for (var i = 0; i < this.matches.length; i++)
24575
+ this._realpathSet(i, next);
24576
+ function next() {
24577
+ if (--n === 0)
24578
+ self2._finish();
24579
+ }
24580
+ };
24581
+ Glob.prototype._realpathSet = function(index4, cb) {
24582
+ var matchset = this.matches[index4];
24583
+ if (!matchset)
24584
+ return cb();
24585
+ var found = Object.keys(matchset);
24586
+ var self2 = this;
24587
+ var n = found.length;
24588
+ if (n === 0)
24589
+ return cb();
24590
+ var set = this.matches[index4] = /* @__PURE__ */ Object.create(null);
24591
+ found.forEach(function(p, i) {
24592
+ p = self2._makeAbs(p);
24593
+ rp.realpath(p, self2.realpathCache, function(er, real) {
24594
+ if (!er)
24595
+ set[real] = true;
24596
+ else if (er.syscall === "stat")
24597
+ set[p] = true;
24598
+ else
24599
+ self2.emit("error", er);
24600
+ if (--n === 0) {
24601
+ self2.matches[index4] = set;
24602
+ cb();
24603
+ }
24604
+ });
24605
+ });
24606
+ };
24607
+ Glob.prototype._mark = function(p) {
24608
+ return common.mark(this, p);
24609
+ };
24610
+ Glob.prototype._makeAbs = function(f) {
24611
+ return common.makeAbs(this, f);
24612
+ };
24613
+ Glob.prototype.abort = function() {
24614
+ this.aborted = true;
24615
+ this.emit("abort");
24616
+ };
24617
+ Glob.prototype.pause = function() {
24618
+ if (!this.paused) {
24619
+ this.paused = true;
24620
+ this.emit("pause");
24621
+ }
24622
+ };
24623
+ Glob.prototype.resume = function() {
24624
+ if (this.paused) {
24625
+ this.emit("resume");
24626
+ this.paused = false;
24627
+ if (this._emitQueue.length) {
24628
+ var eq = this._emitQueue.slice(0);
24629
+ this._emitQueue.length = 0;
24630
+ for (var i = 0; i < eq.length; i++) {
24631
+ var e = eq[i];
24632
+ this._emitMatch(e[0], e[1]);
24633
+ }
24634
+ }
24635
+ if (this._processQueue.length) {
24636
+ var pq = this._processQueue.slice(0);
24637
+ this._processQueue.length = 0;
24638
+ for (var i = 0; i < pq.length; i++) {
24639
+ var p = pq[i];
24640
+ this._processing--;
24641
+ this._process(p[0], p[1], p[2], p[3]);
24642
+ }
24643
+ }
24644
+ }
24645
+ };
24646
+ Glob.prototype._process = function(pattern, index4, inGlobStar, cb) {
24647
+ assert(this instanceof Glob);
24648
+ assert(typeof cb === "function");
24649
+ if (this.aborted)
24650
+ return;
24651
+ this._processing++;
24652
+ if (this.paused) {
24653
+ this._processQueue.push([pattern, index4, inGlobStar, cb]);
24654
+ return;
24655
+ }
24656
+ var n = 0;
24657
+ while (typeof pattern[n] === "string") {
24658
+ n++;
24659
+ }
24660
+ var prefix;
24661
+ switch (n) {
24662
+ case pattern.length:
24663
+ this._processSimple(pattern.join("/"), index4, cb);
24664
+ return;
24665
+ case 0:
24666
+ prefix = null;
24667
+ break;
24668
+ default:
24669
+ prefix = pattern.slice(0, n).join("/");
24670
+ break;
24671
+ }
24672
+ var remain = pattern.slice(n);
24673
+ var read;
24674
+ if (prefix === null)
24675
+ read = ".";
24676
+ else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
24677
+ return typeof p === "string" ? p : "[*]";
24678
+ }).join("/"))) {
24679
+ if (!prefix || !isAbsolute(prefix))
24680
+ prefix = "/" + prefix;
24681
+ read = prefix;
24682
+ } else
24683
+ read = prefix;
24684
+ var abs = this._makeAbs(read);
24685
+ if (childrenIgnored(this, read))
24686
+ return cb();
24687
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
24688
+ if (isGlobStar)
24689
+ this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar, cb);
24690
+ else
24691
+ this._processReaddir(prefix, read, abs, remain, index4, inGlobStar, cb);
24692
+ };
24693
+ Glob.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
24694
+ var self2 = this;
24695
+ this._readdir(abs, inGlobStar, function(er, entries) {
24696
+ return self2._processReaddir2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
24697
+ });
24698
+ };
24699
+ Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
24700
+ if (!entries)
24701
+ return cb();
24702
+ var pn = remain[0];
24703
+ var negate = !!this.minimatch.negate;
24704
+ var rawGlob = pn._glob;
24705
+ var dotOk = this.dot || rawGlob.charAt(0) === ".";
24706
+ var matchedEntries = [];
24707
+ for (var i = 0; i < entries.length; i++) {
24708
+ var e = entries[i];
24709
+ if (e.charAt(0) !== "." || dotOk) {
24710
+ var m;
24711
+ if (negate && !prefix) {
24712
+ m = !e.match(pn);
24713
+ } else {
24714
+ m = e.match(pn);
24715
+ }
24716
+ if (m)
24717
+ matchedEntries.push(e);
24718
+ }
24719
+ }
24720
+ var len = matchedEntries.length;
24721
+ if (len === 0)
24722
+ return cb();
24723
+ if (remain.length === 1 && !this.mark && !this.stat) {
24724
+ if (!this.matches[index4])
24725
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24726
+ for (var i = 0; i < len; i++) {
24727
+ var e = matchedEntries[i];
24728
+ if (prefix) {
24729
+ if (prefix !== "/")
24730
+ e = prefix + "/" + e;
24731
+ else
24732
+ e = prefix + e;
24733
+ }
24734
+ if (e.charAt(0) === "/" && !this.nomount) {
24735
+ e = path2.join(this.root, e);
24736
+ }
24737
+ this._emitMatch(index4, e);
24738
+ }
24739
+ return cb();
24740
+ }
24741
+ remain.shift();
24742
+ for (var i = 0; i < len; i++) {
24743
+ var e = matchedEntries[i];
24744
+ var newPattern;
24745
+ if (prefix) {
24746
+ if (prefix !== "/")
24747
+ e = prefix + "/" + e;
24748
+ else
24749
+ e = prefix + e;
24750
+ }
24751
+ this._process([e].concat(remain), index4, inGlobStar, cb);
24752
+ }
24753
+ cb();
24754
+ };
24755
+ Glob.prototype._emitMatch = function(index4, e) {
24756
+ if (this.aborted)
24757
+ return;
24758
+ if (isIgnored(this, e))
24759
+ return;
24760
+ if (this.paused) {
24761
+ this._emitQueue.push([index4, e]);
24762
+ return;
24763
+ }
24764
+ var abs = isAbsolute(e) ? e : this._makeAbs(e);
24765
+ if (this.mark)
24766
+ e = this._mark(e);
24767
+ if (this.absolute)
24768
+ e = abs;
24769
+ if (this.matches[index4][e])
24770
+ return;
24771
+ if (this.nodir) {
24772
+ var c = this.cache[abs];
24773
+ if (c === "DIR" || Array.isArray(c))
24774
+ return;
24775
+ }
24776
+ this.matches[index4][e] = true;
24777
+ var st = this.statCache[abs];
24778
+ if (st)
24779
+ this.emit("stat", e, st);
24780
+ this.emit("match", e);
24781
+ };
24782
+ Glob.prototype._readdirInGlobStar = function(abs, cb) {
24783
+ if (this.aborted)
24784
+ return;
24785
+ if (this.follow)
24786
+ return this._readdir(abs, false, cb);
24787
+ var lstatkey = "lstat\0" + abs;
24788
+ var self2 = this;
24789
+ var lstatcb = inflight(lstatkey, lstatcb_);
24790
+ if (lstatcb)
24791
+ self2.fs.lstat(abs, lstatcb);
24792
+ function lstatcb_(er, lstat) {
24793
+ if (er && er.code === "ENOENT")
24794
+ return cb();
24795
+ var isSym = lstat && lstat.isSymbolicLink();
24796
+ self2.symlinks[abs] = isSym;
24797
+ if (!isSym && lstat && !lstat.isDirectory()) {
24798
+ self2.cache[abs] = "FILE";
24799
+ cb();
24800
+ } else
24801
+ self2._readdir(abs, false, cb);
24802
+ }
24803
+ };
24804
+ Glob.prototype._readdir = function(abs, inGlobStar, cb) {
24805
+ if (this.aborted)
24806
+ return;
24807
+ cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
24808
+ if (!cb)
24809
+ return;
24810
+ if (inGlobStar && !ownProp(this.symlinks, abs))
24811
+ return this._readdirInGlobStar(abs, cb);
24812
+ if (ownProp(this.cache, abs)) {
24813
+ var c = this.cache[abs];
24814
+ if (!c || c === "FILE")
24815
+ return cb();
24816
+ if (Array.isArray(c))
24817
+ return cb(null, c);
24818
+ }
24819
+ var self2 = this;
24820
+ self2.fs.readdir(abs, readdirCb(this, abs, cb));
24821
+ };
24822
+ function readdirCb(self2, abs, cb) {
24823
+ return function(er, entries) {
24824
+ if (er)
24825
+ self2._readdirError(abs, er, cb);
24826
+ else
24827
+ self2._readdirEntries(abs, entries, cb);
24828
+ };
24829
+ }
24830
+ Glob.prototype._readdirEntries = function(abs, entries, cb) {
24831
+ if (this.aborted)
24832
+ return;
24833
+ if (!this.mark && !this.stat) {
24834
+ for (var i = 0; i < entries.length; i++) {
24835
+ var e = entries[i];
24836
+ if (abs === "/")
24837
+ e = abs + e;
24838
+ else
24839
+ e = abs + "/" + e;
24840
+ this.cache[e] = true;
24841
+ }
24842
+ }
24843
+ this.cache[abs] = entries;
24844
+ return cb(null, entries);
24845
+ };
24846
+ Glob.prototype._readdirError = function(f, er, cb) {
24847
+ if (this.aborted)
24848
+ return;
24849
+ switch (er.code) {
24850
+ case "ENOTSUP":
24851
+ case "ENOTDIR":
24852
+ var abs = this._makeAbs(f);
24853
+ this.cache[abs] = "FILE";
24854
+ if (abs === this.cwdAbs) {
24855
+ var error2 = new Error(er.code + " invalid cwd " + this.cwd);
24856
+ error2.path = this.cwd;
24857
+ error2.code = er.code;
24858
+ this.emit("error", error2);
24859
+ this.abort();
24860
+ }
24861
+ break;
24862
+ case "ENOENT":
24863
+ case "ELOOP":
24864
+ case "ENAMETOOLONG":
24865
+ case "UNKNOWN":
24866
+ this.cache[this._makeAbs(f)] = false;
24867
+ break;
24868
+ default:
24869
+ this.cache[this._makeAbs(f)] = false;
24870
+ if (this.strict) {
24871
+ this.emit("error", er);
24872
+ this.abort();
24873
+ }
24874
+ if (!this.silent)
24875
+ console.error("glob error", er);
24876
+ break;
24877
+ }
24878
+ return cb();
24879
+ };
24880
+ Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
24881
+ var self2 = this;
24882
+ this._readdir(abs, inGlobStar, function(er, entries) {
24883
+ self2._processGlobStar2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
24884
+ });
24885
+ };
24886
+ Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
24887
+ if (!entries)
24888
+ return cb();
24889
+ var remainWithoutGlobStar = remain.slice(1);
24890
+ var gspref = prefix ? [prefix] : [];
24891
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
24892
+ this._process(noGlobStar, index4, false, cb);
24893
+ var isSym = this.symlinks[abs];
24894
+ var len = entries.length;
24895
+ if (isSym && inGlobStar)
24896
+ return cb();
24897
+ for (var i = 0; i < len; i++) {
24898
+ var e = entries[i];
24899
+ if (e.charAt(0) === "." && !this.dot)
24900
+ continue;
24901
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
24902
+ this._process(instead, index4, true, cb);
24903
+ var below = gspref.concat(entries[i], remain);
24904
+ this._process(below, index4, true, cb);
24905
+ }
24906
+ cb();
24907
+ };
24908
+ Glob.prototype._processSimple = function(prefix, index4, cb) {
24909
+ var self2 = this;
24910
+ this._stat(prefix, function(er, exists) {
24911
+ self2._processSimple2(prefix, index4, er, exists, cb);
24912
+ });
24913
+ };
24914
+ Glob.prototype._processSimple2 = function(prefix, index4, er, exists, cb) {
24915
+ if (!this.matches[index4])
24916
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24917
+ if (!exists)
24918
+ return cb();
24919
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
24920
+ var trail = /[\/\\]$/.test(prefix);
24921
+ if (prefix.charAt(0) === "/") {
24922
+ prefix = path2.join(this.root, prefix);
24923
+ } else {
24924
+ prefix = path2.resolve(this.root, prefix);
24925
+ if (trail)
24926
+ prefix += "/";
24927
+ }
24928
+ }
24929
+ if (process.platform === "win32")
24930
+ prefix = prefix.replace(/\\/g, "/");
24931
+ this._emitMatch(index4, prefix);
24932
+ cb();
24933
+ };
24934
+ Glob.prototype._stat = function(f, cb) {
24935
+ var abs = this._makeAbs(f);
24936
+ var needDir = f.slice(-1) === "/";
24937
+ if (f.length > this.maxLength)
24938
+ return cb();
24939
+ if (!this.stat && ownProp(this.cache, abs)) {
24940
+ var c = this.cache[abs];
24941
+ if (Array.isArray(c))
24942
+ c = "DIR";
24943
+ if (!needDir || c === "DIR")
24944
+ return cb(null, c);
24945
+ if (needDir && c === "FILE")
24946
+ return cb();
24947
+ }
24948
+ var exists;
24949
+ var stat = this.statCache[abs];
24950
+ if (stat !== void 0) {
24951
+ if (stat === false)
24952
+ return cb(null, stat);
24953
+ else {
24954
+ var type = stat.isDirectory() ? "DIR" : "FILE";
24955
+ if (needDir && type === "FILE")
24956
+ return cb();
24957
+ else
24958
+ return cb(null, type, stat);
24959
+ }
24960
+ }
24961
+ var self2 = this;
24962
+ var statcb = inflight("stat\0" + abs, lstatcb_);
24963
+ if (statcb)
24964
+ self2.fs.lstat(abs, statcb);
24965
+ function lstatcb_(er, lstat) {
24966
+ if (lstat && lstat.isSymbolicLink()) {
24967
+ return self2.fs.stat(abs, function(er2, stat2) {
24968
+ if (er2)
24969
+ self2._stat2(f, abs, null, lstat, cb);
24970
+ else
24971
+ self2._stat2(f, abs, er2, stat2, cb);
24972
+ });
24973
+ } else {
24974
+ self2._stat2(f, abs, er, lstat, cb);
24975
+ }
24976
+ }
24977
+ };
24978
+ Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
24979
+ if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
24980
+ this.statCache[abs] = false;
24981
+ return cb();
24982
+ }
24983
+ var needDir = f.slice(-1) === "/";
24984
+ this.statCache[abs] = stat;
24985
+ if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
24986
+ return cb(null, false, stat);
24987
+ var c = true;
24988
+ if (stat)
24989
+ c = stat.isDirectory() ? "DIR" : "FILE";
24990
+ this.cache[abs] = this.cache[abs] || c;
24991
+ if (needDir && c === "FILE")
24992
+ return cb();
24993
+ return cb(null, c, stat);
24994
+ };
24995
+ }
24996
+ });
24997
+
22340
24998
  // src/serializer/mysqlImports.ts
22341
24999
  var mysqlImports_exports = {};
22342
25000
  __export(mysqlImports_exports, {
@@ -22393,7 +25051,7 @@ function clearDefaults(defaultValue, collate) {
22393
25051
  return `(${resultDefault})`;
22394
25052
  }
22395
25053
  }
22396
- var import_mysql_core2, import_table, import_utils7, import_sql, import_common, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
25054
+ var import_mysql_core2, import_table, import_utils7, import_sql, import_common, import_date, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
22397
25055
  var init_mysqlSerializer = __esm({
22398
25056
  "src/serializer/mysqlSerializer.ts"() {
22399
25057
  import_mysql_core2 = require("drizzle-orm/mysql-core");
@@ -22401,6 +25059,7 @@ var init_mysqlSerializer = __esm({
22401
25059
  import_utils7 = require("drizzle-orm/mysql-core/utils");
22402
25060
  import_sql = require("drizzle-orm/sql");
22403
25061
  import_common = require("drizzle-orm/mysql-core/columns/common");
25062
+ import_date = require("drizzle-orm/mysql-core/columns/date.common");
22404
25063
  dialect3 = new import_mysql_core2.MySqlDialect();
22405
25064
  indexName = (tableName, columns) => {
22406
25065
  return `${tableName}_${columns.join("_")}_index`;
@@ -22421,12 +25080,14 @@ var init_mysqlSerializer = __esm({
22421
25080
  columns.forEach((column6) => {
22422
25081
  const notNull = column6.notNull;
22423
25082
  const primaryKey = column6.primary;
25083
+ const sqlTypeLowered = column6.getSQLType().toLowerCase();
22424
25084
  const columnToSet = {
22425
25085
  name: column6.name,
22426
25086
  type: column6.getSQLType(),
22427
25087
  primaryKey,
22428
25088
  notNull,
22429
- autoincrement: column6 instanceof import_common.MySqlColumnWithAutoIncrement ? column6.autoIncrement : false
25089
+ autoincrement: column6 instanceof import_common.MySqlColumnWithAutoIncrement ? column6.autoIncrement : false,
25090
+ onUpdate: column6 instanceof import_date.MySqlDateBaseColumn ? column6.hasOnUpdateNow : void 0
22430
25091
  };
22431
25092
  if (column6.default !== void 0) {
22432
25093
  if (column6.default instanceof import_sql.SQL) {
@@ -22437,7 +25098,17 @@ var init_mysqlSerializer = __esm({
22437
25098
  throw new Error();
22438
25099
  }).join();
22439
25100
  } else {
22440
- columnToSet.default = typeof column6.default === "string" ? `'${column6.default}'` : column6.default;
25101
+ if (typeof column6.default === "string") {
25102
+ columnToSet.default = `"${column6.default}"`;
25103
+ } else {
25104
+ if (sqlTypeLowered === "json") {
25105
+ columnToSet.default = `'${JSON.stringify(column6.default)}'`;
25106
+ } else if (column6.default instanceof Date) {
25107
+ columnToSet.default = `'${column6.default.toISOString()}'`;
25108
+ } else {
25109
+ columnToSet.default = column6.default;
25110
+ }
25111
+ }
22441
25112
  }
22442
25113
  if (["blob", "text", "json"].includes(column6.getSQLType())) {
22443
25114
  columnToSet.default = `(${columnToSet.default})`;
@@ -22511,10 +25182,10 @@ var init_mysqlSerializer = __esm({
22511
25182
  }
22512
25183
  };
22513
25184
  };
22514
- fromDatabase = async (db, schema4, progressCallback) => {
25185
+ fromDatabase = async (db, inputSchema, progressCallback) => {
22515
25186
  const result = {};
22516
25187
  const columns = await db.execute(`select * from information_schema.columns
22517
- where table_schema = '${schema4}'
25188
+ where table_schema = '${inputSchema}' and table_name != '__drizzle_migrations'
22518
25189
  order by table_name, ordinal_position;`);
22519
25190
  const response = columns[0];
22520
25191
  const schemas = [];
@@ -22525,9 +25196,9 @@ var init_mysqlSerializer = __esm({
22525
25196
  for (const column6 of response) {
22526
25197
  columnsCount += 1;
22527
25198
  progressCallback("columns", columnsCount, "fetching");
22528
- const schema5 = column6["TABLE_SCHEMA"];
25199
+ const schema4 = column6["TABLE_SCHEMA"];
22529
25200
  const tableName = column6["TABLE_NAME"];
22530
- tablesCount.add(`${schema5}.${tableName}`);
25201
+ tablesCount.add(`${schema4}.${tableName}`);
22531
25202
  progressCallback("columns", tablesCount.size, "fetching");
22532
25203
  const columnName = column6["COLUMN_NAME"];
22533
25204
  const isNullable = column6["IS_NULLABLE"] === "YES";
@@ -22538,7 +25209,9 @@ var init_mysqlSerializer = __esm({
22538
25209
  const isDefaultAnExpression = column6["EXTRA"] === "DEFAULT_GENERATED";
22539
25210
  const columnDefault = column6["COLUMN_DEFAULT"];
22540
25211
  const collation = column6["CHARACTER_SET_NAME"];
22541
- schemas.push(schema5);
25212
+ if (schema4 !== inputSchema) {
25213
+ schemas.push(schema4);
25214
+ }
22542
25215
  const table4 = result[tableName];
22543
25216
  const newColumn = {
22544
25217
  default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : isDefaultAnExpression ? clearDefaults(columnDefault, collation) : `"${columnDefault}"`,
@@ -22551,7 +25224,7 @@ var init_mysqlSerializer = __esm({
22551
25224
  if (!table4) {
22552
25225
  result[tableName] = {
22553
25226
  name: tableName,
22554
- schema: schema5,
25227
+ schema: schema4 !== inputSchema ? schema4 : void 0,
22555
25228
  columns: {
22556
25229
  [columnName]: newColumn
22557
25230
  },
@@ -22564,56 +25237,62 @@ var init_mysqlSerializer = __esm({
22564
25237
  }
22565
25238
  progressCallback("columns", columnsCount, "done");
22566
25239
  progressCallback("tables", tablesCount.size, "done");
22567
- const fks = await db.execute(
22568
- `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,information_schema.referential_constraints.UPDATE_RULE, information_schema.referential_constraints.DELETE_RULE
25240
+ try {
25241
+ const fks = await db.execute(
25242
+ `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,information_schema.referential_constraints.UPDATE_RULE, information_schema.referential_constraints.DELETE_RULE
22569
25243
  FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
22570
25244
  LEFT JOIN information_schema.referential_constraints on information_schema.referential_constraints.constraint_name = information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME
22571
25245
  WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
22572
25246
  `,
22573
- [schema4]
22574
- );
22575
- const fkRows = fks[0];
22576
- for (const fkRow of fkRows) {
22577
- foreignKeysCount += 1;
22578
- progressCallback("fks", foreignKeysCount, "fetching");
22579
- const tableSchema = fkRow["TABLE_SCHEMA"];
22580
- const tableName = fkRow["TABLE_NAME"];
22581
- const constraintName = fkRow["CONSTRAINT_NAME"];
22582
- const columnName = fkRow["COLUMN_NAME"];
22583
- const refTableSchema = fkRow["REFERENCED_TABLE_SCHEMA"];
22584
- const refTableName = fkRow["REFERENCED_TABLE_NAME"];
22585
- const refColumnName = fkRow["REFERENCED_COLUMN_NAME"];
22586
- const updateRule = fkRow["UPDATE_RULE"];
22587
- const deleteRule = fkRow["DELETE_RULE"];
22588
- const tableInResult = result[tableName];
22589
- if (typeof tableInResult === "undefined")
22590
- continue;
22591
- if (typeof tableInResult.foreignKeys[constraintName] !== "undefined") {
22592
- tableInResult.foreignKeys[constraintName].columnsFrom.push(columnName);
22593
- tableInResult.foreignKeys[constraintName].columnsTo.push(refColumnName);
22594
- } else {
22595
- tableInResult.foreignKeys[constraintName] = {
22596
- name: constraintName,
22597
- tableFrom: tableName,
22598
- tableTo: refTableName,
22599
- columnsFrom: [columnName],
22600
- columnsTo: [refColumnName],
22601
- onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
22602
- onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
22603
- };
25247
+ [inputSchema]
25248
+ );
25249
+ const fkRows = fks[0];
25250
+ for (const fkRow of fkRows) {
25251
+ foreignKeysCount += 1;
25252
+ progressCallback("fks", foreignKeysCount, "fetching");
25253
+ const tableSchema = fkRow["TABLE_SCHEMA"];
25254
+ const tableName = fkRow["TABLE_NAME"];
25255
+ const constraintName = fkRow["CONSTRAINT_NAME"];
25256
+ const columnName = fkRow["COLUMN_NAME"];
25257
+ const refTableSchema = fkRow["REFERENCED_TABLE_SCHEMA"];
25258
+ const refTableName = fkRow["REFERENCED_TABLE_NAME"];
25259
+ const refColumnName = fkRow["REFERENCED_COLUMN_NAME"];
25260
+ const updateRule = fkRow["UPDATE_RULE"];
25261
+ const deleteRule = fkRow["DELETE_RULE"];
25262
+ const tableInResult = result[tableName];
25263
+ if (typeof tableInResult === "undefined")
25264
+ continue;
25265
+ if (typeof tableInResult.foreignKeys[constraintName] !== "undefined") {
25266
+ tableInResult.foreignKeys[constraintName].columnsFrom.push(columnName);
25267
+ tableInResult.foreignKeys[constraintName].columnsTo.push(
25268
+ refColumnName
25269
+ );
25270
+ } else {
25271
+ tableInResult.foreignKeys[constraintName] = {
25272
+ name: constraintName,
25273
+ tableFrom: tableName,
25274
+ tableTo: refTableName,
25275
+ columnsFrom: [columnName],
25276
+ columnsTo: [refColumnName],
25277
+ onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
25278
+ onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
25279
+ };
25280
+ }
25281
+ tableInResult.foreignKeys[constraintName].columnsFrom = [
25282
+ ...new Set(tableInResult.foreignKeys[constraintName].columnsFrom)
25283
+ ];
25284
+ tableInResult.foreignKeys[constraintName].columnsTo = [
25285
+ ...new Set(tableInResult.foreignKeys[constraintName].columnsTo)
25286
+ ];
22604
25287
  }
22605
- tableInResult.foreignKeys[constraintName].columnsFrom = [
22606
- ...new Set(tableInResult.foreignKeys[constraintName].columnsFrom)
22607
- ];
22608
- tableInResult.foreignKeys[constraintName].columnsTo = [
22609
- ...new Set(tableInResult.foreignKeys[constraintName].columnsTo)
22610
- ];
25288
+ } catch (e) {
25289
+ console.log(`Can't proccess foreign keys`);
22611
25290
  }
22612
25291
  progressCallback("fks", foreignKeysCount, "done");
22613
25292
  const idxs = await db.execute(
22614
25293
  `select * from INFORMATION_SCHEMA.STATISTICS
22615
25294
  WHERE INFORMATION_SCHEMA.STATISTICS.TABLE_SCHEMA = ? and INFORMATION_SCHEMA.STATISTICS.INDEX_NAME != 'PRIMARY';`,
22616
- [schema4]
25295
+ [inputSchema]
22617
25296
  );
22618
25297
  const idxRows = idxs[0];
22619
25298
  for (const idxRow of idxRows) {
@@ -23221,12 +25900,13 @@ var init_sqliteSerializer = __esm({
23221
25900
  });
23222
25901
 
23223
25902
  // src/serializer/index.ts
23224
- var import_fs3, import_node, import_path3, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
25903
+ var import_fs3, import_node, import_path3, import_glob, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
23225
25904
  var init_serializer = __esm({
23226
25905
  "src/serializer/index.ts"() {
23227
25906
  import_fs3 = __toESM(require("fs"));
23228
25907
  import_node = __toESM(require_node2());
23229
25908
  import_path3 = __toESM(require("path"));
25909
+ import_glob = __toESM(require_glob());
23230
25910
  safeRegister = () => {
23231
25911
  try {
23232
25912
  const { unregister } = (0, import_node.register)({
@@ -23239,8 +25919,8 @@ var init_serializer = __esm({
23239
25919
  } };
23240
25920
  }
23241
25921
  };
23242
- serializeMySql = (path4) => {
23243
- const filenames = prepareFilenames(path4);
25922
+ serializeMySql = (path2) => {
25923
+ const filenames = prepareFilenames(path2);
23244
25924
  const { unregister } = safeRegister();
23245
25925
  const { prepareFromMySqlImports: prepareFromMySqlImports2 } = (init_mysqlImports(), __toCommonJS(mysqlImports_exports));
23246
25926
  const { generateMySqlSnapshot: generateMySqlSnapshot2 } = (init_mysqlSerializer(), __toCommonJS(mysqlSerializer_exports));
@@ -23248,8 +25928,8 @@ var init_serializer = __esm({
23248
25928
  unregister();
23249
25929
  return generateMySqlSnapshot2(tables, enums, schemas);
23250
25930
  };
23251
- serializePg = (path4) => {
23252
- const filenames = prepareFilenames(path4);
25931
+ serializePg = (path2) => {
25932
+ const filenames = prepareFilenames(path2);
23253
25933
  const { unregister } = safeRegister();
23254
25934
  const { prepareFromPgImports: prepareFromPgImports2 } = (init_pgImports(), __toCommonJS(pgImports_exports));
23255
25935
  const { generatePgSnapshot: generatePgSnapshot2 } = (init_pgSerializer(), __toCommonJS(pgSerializer_exports));
@@ -23257,8 +25937,8 @@ var init_serializer = __esm({
23257
25937
  unregister();
23258
25938
  return generatePgSnapshot2(tables, enums, schemas);
23259
25939
  };
23260
- serializeSQLite = (path4) => {
23261
- const filenames = prepareFilenames(path4);
25940
+ serializeSQLite = (path2) => {
25941
+ const filenames = prepareFilenames(path2);
23262
25942
  const { unregister } = safeRegister();
23263
25943
  const { prepareFromSqliteImports: prepareFromSqliteImports2 } = (init_sqliteImports(), __toCommonJS(sqliteImports_exports));
23264
25944
  const { generateSqliteSnapshot: generateSqliteSnapshot2 } = (init_sqliteSerializer(), __toCommonJS(sqliteSerializer_exports));
@@ -23266,10 +25946,20 @@ var init_serializer = __esm({
23266
25946
  unregister();
23267
25947
  return generateSqliteSnapshot2(tables, enums);
23268
25948
  };
23269
- prepareFilenames = (path4) => {
23270
- const fileName = import_fs3.default.lstatSync(path4).isDirectory() ? null : import_path3.default.resolve(path4);
23271
- const filenames = fileName ? [fileName] : import_fs3.default.readdirSync(path4).map((it) => import_path3.default.join(import_path3.default.resolve(path4), it));
23272
- return filenames;
25949
+ prepareFilenames = (path2) => {
25950
+ if (typeof path2 === "string") {
25951
+ path2 = [path2];
25952
+ }
25953
+ const result = path2.reduce((result2, cur) => {
25954
+ const globbed = import_glob.default.sync(cur);
25955
+ globbed.forEach((it) => {
25956
+ const fileName = import_fs3.default.lstatSync(it).isDirectory() ? null : import_path3.default.resolve(it);
25957
+ const filenames = fileName ? [fileName] : import_fs3.default.readdirSync(it).map((file) => import_path3.default.join(import_path3.default.resolve(it), file));
25958
+ filenames.filter((file) => !import_fs3.default.lstatSync(file).isDirectory()).forEach((file) => result2.add(file));
25959
+ });
25960
+ return result2;
25961
+ }, /* @__PURE__ */ new Set());
25962
+ return [...result];
23273
25963
  };
23274
25964
  }
23275
25965
  });
@@ -23429,7 +26119,7 @@ var init_migrate = __esm({
23429
26119
  const { sqlStatements, _meta } = await prepareSQL(
23430
26120
  squashedPrev,
23431
26121
  squashedCur,
23432
- "mysql"
26122
+ "sqlite"
23433
26123
  );
23434
26124
  writeResult(
23435
26125
  cur,
@@ -23630,7 +26320,7 @@ var init_migrate = __esm({
23630
26320
  console.log("No schema changes, nothing to migrate \u{1F634}");
23631
26321
  return;
23632
26322
  }
23633
- const idx = (_b = (_a = journal.entries[journal.entries.length - 1]) == null ? void 0 : _a.idx) != null ? _b : 0;
26323
+ const idx = ((_b = (_a = journal.entries[journal.entries.length - 1]) == null ? void 0 : _a.idx) != null ? _b : 0) + 1;
23634
26324
  const { prefix, tag } = prepareMigrationMetadata(idx);
23635
26325
  const toSave = JSON.parse(JSON.stringify(cur));
23636
26326
  toSave["_meta"] = _meta;
@@ -23644,6 +26334,7 @@ var init_migrate = __esm({
23644
26334
  const sql = sqlStatements.join(sqlDelimiter);
23645
26335
  journal.entries.push({
23646
26336
  idx,
26337
+ version: cur.version,
23647
26338
  when: +new Date(),
23648
26339
  tag,
23649
26340
  breakpoints
@@ -25173,7 +27864,7 @@ var require_split2 = __commonJS({
25173
27864
  var require_helper = __commonJS({
25174
27865
  "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
25175
27866
  "use strict";
25176
- var path4 = require("path");
27867
+ var path2 = require("path");
25177
27868
  var Stream = require("stream").Stream;
25178
27869
  var split = require_split2();
25179
27870
  var util2 = require("util");
@@ -25212,7 +27903,7 @@ var require_helper = __commonJS({
25212
27903
  };
25213
27904
  module2.exports.getFileName = function(rawEnv) {
25214
27905
  var env2 = rawEnv || process.env;
25215
- var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
27906
+ var file = env2.PGPASSFILE || (isWin ? path2.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path2.join(env2.HOME || "./", ".pgpass"));
25216
27907
  return file;
25217
27908
  };
25218
27909
  module2.exports.usePgPass = function(stats, fname) {
@@ -25339,7 +28030,7 @@ var require_helper = __commonJS({
25339
28030
  var require_lib2 = __commonJS({
25340
28031
  "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
25341
28032
  "use strict";
25342
- var path4 = require("path");
28033
+ var path2 = require("path");
25343
28034
  var fs7 = require("fs");
25344
28035
  var helper = require_helper();
25345
28036
  module2.exports = function(connInfo, cb) {
@@ -40703,12 +43394,12 @@ var require_query4 = __commonJS({
40703
43394
  this._fields.push([]);
40704
43395
  return this.readField;
40705
43396
  }
40706
- _streamLocalInfile(connection, path4) {
43397
+ _streamLocalInfile(connection, path2) {
40707
43398
  if (this._streamFactory) {
40708
- this._localStream = this._streamFactory(path4);
43399
+ this._localStream = this._streamFactory(path2);
40709
43400
  } else {
40710
43401
  this._localStreamError = new Error(
40711
- `As a result of LOCAL INFILE command server wants to read ${path4} file, but as of v2.0 you must provide streamFactory option returning ReadStream.`
43402
+ `As a result of LOCAL INFILE command server wants to read ${path2} file, but as of v2.0 you must provide streamFactory option returning ReadStream.`
40712
43403
  );
40713
43404
  connection.writePacket(EmptyPacket);
40714
43405
  return this.infileOk;
@@ -44892,13 +47583,13 @@ var init_mysql_introspect = __esm({
44892
47583
  },
44893
47584
  { mysql: [] }
44894
47585
  );
44895
- const schemaStatements = Object.entries(schemas).filter((it) => it[0] !== "public").map((it) => {
47586
+ const schemaStatements = Object.entries(schemas).map((it) => {
44896
47587
  return `export const ${it[1]} = mysqlSchema("${it[0]}");
44897
47588
  `;
44898
47589
  }).join();
44899
47590
  const tableStatements = Object.values(schema4.tables).map((table4) => {
44900
47591
  const schema5 = schemas[table4.schema];
44901
- const func = schema5 || schema5 === "public" ? "mysqlTable" : schema5;
47592
+ const func = schema5 ? schema5 : "mysqlTable";
44902
47593
  let statement = "";
44903
47594
  if (imports.mysql.includes(table4.name.camelCase())) {
44904
47595
  statement = `// Table name is in conflict with ${table4.name.camelCase()} import.
@@ -45228,16 +47919,21 @@ var init_mysqlIntrospect = __esm({
45228
47919
  if (typeof config.connectionString !== "undefined") {
45229
47920
  const connection = config.connectionString;
45230
47921
  client = await (0, import_promise.createConnection)(connection);
45231
- databaseName = connection.split("/")[connection.split("/").length - 1];
47922
+ const connectionUrl = new URL(connection);
47923
+ const pathname = connectionUrl.pathname;
47924
+ databaseName = pathname.split("/")[pathname.split("/").length - 1];
45232
47925
  } else {
45233
47926
  client = await (0, import_promise.createConnection)(config);
45234
47927
  databaseName = config.database;
45235
47928
  }
45236
47929
  await client.connect();
45237
47930
  const progress = new IntrospectProgress();
45238
- const res = await (0, import_hanji5.renderWithTask)(progress, fromDatabase(client, databaseName, (stage, count, status) => {
45239
- progress.update(stage, count, status);
45240
- }));
47931
+ const res = await (0, import_hanji5.renderWithTask)(
47932
+ progress,
47933
+ fromDatabase(client, databaseName, (stage, count, status) => {
47934
+ progress.update(stage, count, status);
47935
+ })
47936
+ );
45241
47937
  const schema4 = { id: originUUID, prevId: "", ...res };
45242
47938
  const ts = schemaToTypeScript2(schema4);
45243
47939
  return { schema: schema4, ts };
@@ -45313,7 +48009,7 @@ var checkHandler = (out, dialect6) => {
45313
48009
  // src/cli/index.ts
45314
48010
  var import_hanji6 = __toESM(require_hanji());
45315
48011
  init_views();
45316
- var import_path8 = __toESM(require("path"));
48012
+ var import_path6 = __toESM(require("path"));
45317
48013
 
45318
48014
  // src/cli/utils.ts
45319
48015
  init_views();
@@ -45362,15 +48058,16 @@ var package_default = {
45362
48058
  name: "drizzle-kit",
45363
48059
  version: "0.16.9",
45364
48060
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
45365
- author: "Alex Blokh <aleksandrblokh@gmail.com>",
48061
+ author: "Drizzle Team",
45366
48062
  license: "MIT",
45367
48063
  bin: {
45368
48064
  "drizzle-kit": "./index.js"
45369
48065
  },
45370
48066
  scripts: {
45371
48067
  "start:pg": "node -r esbuild-register ./src/cli/index.ts generate --out ./dev/migrations --dialect pg --schema ./dev/data",
48068
+ "start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql --out ./dev/migrations --schema ./dev/migrations/schema.ts",
45372
48069
  "check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
45373
- "introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --out ./dev/migrations --connectionString mysql://root:password123@127.0.0.1:3306/mySchema",
48070
+ "introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --out ./dev/migrations --connectionString ",
45374
48071
  "up:pg": "node -r esbuild-register ./src/cli/index.ts up --out ./dev/equedi --dialect pg",
45375
48072
  "check:equedi": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/equedi --dialect pg",
45376
48073
  run: "node -r esbuild-register index.ts",
@@ -45406,12 +48103,14 @@ var package_default = {
45406
48103
  commander: "^9.4.1",
45407
48104
  esbuild: "^0.15.18",
45408
48105
  "esbuild-register": "^3.4.2",
48106
+ glob: "^8.1.0",
45409
48107
  hanji: "^0.0.5",
45410
48108
  "json-diff": "0.9.0",
45411
48109
  zod: "^3.20.2"
45412
48110
  },
45413
48111
  devDependencies: {
45414
48112
  "@types/dockerode": "^3.3.14",
48113
+ "@types/glob": "^8.1.0",
45415
48114
  "@types/node": "^18.11.15",
45416
48115
  "@types/pg": "^8.6.5",
45417
48116
  "@typescript-eslint/eslint-plugin": "^5.46.1",
@@ -45419,7 +48118,7 @@ var package_default = {
45419
48118
  ava: "^5.1.0",
45420
48119
  dockerode: "^3.3.4",
45421
48120
  "drizzle-kit": "^0.16.8",
45422
- "drizzle-orm": "0.19.0-03308d4",
48121
+ "drizzle-orm": "0.21.0-2e66963",
45423
48122
  esbuild: "^0.15.7",
45424
48123
  "esbuild-register": "^3.3.3",
45425
48124
  eslint: "^8.29.0",
@@ -45458,11 +48157,11 @@ var upPgHandlerV4 = (out) => {
45458
48157
  path: it,
45459
48158
  raw: report.rawMap[it]
45460
48159
  })).forEach((it) => {
45461
- const path4 = it.path;
48160
+ const path2 = it.path;
45462
48161
  const result = updateUpToV4(it.raw, prevId);
45463
48162
  prevId = result.id;
45464
- console.log(`[${source_default.green("\u2713")}] ${path4}`);
45465
- (0, import_fs6.writeFileSync)(path4, JSON.stringify(result, null, 2));
48163
+ console.log(`[${source_default.green("\u2713")}] ${path2}`);
48164
+ (0, import_fs6.writeFileSync)(path2, JSON.stringify(result, null, 2));
45466
48165
  });
45467
48166
  console.log("Everything's fine \u{1F436}\u{1F525}");
45468
48167
  };
@@ -45630,29 +48329,25 @@ var update3to4 = (json) => {
45630
48329
  // src/cli/commands/sqliteUp.ts
45631
48330
  init_source();
45632
48331
  var import_fs7 = __toESM(require("fs"));
45633
- var import_path5 = __toESM(require("path"));
45634
48332
  init_sqliteSchema();
45635
48333
  init_utils();
45636
48334
  var upSqliteHandler = (out) => {
45637
- const { snapshots } = prepareOutFolder(out, "sqlite");
48335
+ };
48336
+ var upSqliteHandlerV4 = (out) => {
48337
+ const snapshots = snapshotsPriorV4(out);
45638
48338
  const report = validateWithReport(snapshots, "sqlite");
45639
48339
  report.nonLatest.map((it) => ({
45640
- folder: it,
48340
+ path: it,
45641
48341
  raw: report.rawMap[it]
45642
48342
  })).forEach((it) => {
45643
- const folder = it.folder;
45644
- const result = updateToLatest(it.raw);
45645
- console.log(
45646
- `[${source_default.green("\u2713")}] ${import_path5.default.join(out, folder, "snapshot.json")}`
45647
- );
45648
- import_fs7.default.writeFileSync(
45649
- import_path5.default.join(out, folder, "snapshot.json"),
45650
- JSON.stringify(result, null, 2)
45651
- );
48343
+ const path2 = it.path;
48344
+ const result = updateToLatestV4(it.raw);
48345
+ console.log(`[${source_default.green("\u2713")}] ${path2}`);
48346
+ import_fs7.default.writeFileSync(path2, JSON.stringify(result, null, 2));
45652
48347
  });
45653
48348
  console.log("Everything's fine \u{1F436}\u{1F525}");
45654
48349
  };
45655
- var updateToLatest = (json) => {
48350
+ var updateToLatestV4 = (json) => {
45656
48351
  const version = Number(json["version"]);
45657
48352
  if (version === 3) {
45658
48353
  const v3 = sqliteSchemaV3.parse(json);
@@ -45678,31 +48373,25 @@ var updateV3toV4 = (old) => {
45678
48373
  // src/cli/commands/mysqlUp.ts
45679
48374
  init_source();
45680
48375
  var import_fs8 = __toESM(require("fs"));
45681
- var import_path6 = __toESM(require("path"));
45682
48376
  init_mysqlSchema();
45683
48377
  init_utils();
45684
48378
  var upMysqlHandler = (out) => {
45685
48379
  };
45686
48380
  var upMysqlHandlerV4 = (out) => {
45687
- const { snapshots } = prepareOutFolder(out, "mysql");
48381
+ const snapshots = snapshotsPriorV4(out);
45688
48382
  const report = validateWithReport(snapshots, "mysql");
45689
48383
  report.nonLatest.map((it) => ({
45690
- folder: it,
48384
+ path: it,
45691
48385
  raw: report.rawMap[it]
45692
48386
  })).forEach((it) => {
45693
- const folder = it.folder;
45694
- const result = updateToLatestV4(it.raw);
45695
- console.log(
45696
- `[${source_default.green("\u2713")}] ${import_path6.default.join(out, folder, "snapshot.json")}`
45697
- );
45698
- import_fs8.default.writeFileSync(
45699
- import_path6.default.join(out, folder, "snapshot.json"),
45700
- JSON.stringify(result, null, 2)
45701
- );
48387
+ const path2 = it.path;
48388
+ const result = updateToLatestV42(it.raw);
48389
+ console.log(`[${source_default.green("\u2713")}] ${path2}`);
48390
+ import_fs8.default.writeFileSync(path2, JSON.stringify(result, null, 2));
45702
48391
  });
45703
48392
  console.log("Everything's fine \u{1F436}\u{1F525}");
45704
48393
  };
45705
- var updateToLatestV4 = (json) => {
48394
+ var updateToLatestV42 = (json) => {
45706
48395
  const version = Number(json["version"]);
45707
48396
  if (version === 3) {
45708
48397
  const v3 = mysqlSchemaV3.parse(json);
@@ -45727,10 +48416,10 @@ init_mysqlSchema();
45727
48416
  init_source();
45728
48417
  var import_fs9 = require("fs");
45729
48418
  var import_hanji3 = __toESM(require_hanji());
45730
- var import_path7 = require("path");
48419
+ var import_path5 = require("path");
45731
48420
  init_views();
45732
48421
  var dropMigration = async (out) => {
45733
- const metaFilePath = (0, import_path7.join)(out, "meta", "_journal.json");
48422
+ const metaFilePath = (0, import_path5.join)(out, "meta", "_journal.json");
45734
48423
  const journal = JSON.parse(
45735
48424
  (0, import_fs9.readFileSync)(metaFilePath, "utf-8")
45736
48425
  );
@@ -45742,8 +48431,8 @@ var dropMigration = async (out) => {
45742
48431
  ...journal,
45743
48432
  entries: journal.entries.filter(Boolean)
45744
48433
  };
45745
- const sqlFilePath = (0, import_path7.join)(out, `${result.data.tag}.sql`);
45746
- const snapshotFilePath = (0, import_path7.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
48434
+ const sqlFilePath = (0, import_path5.join)(out, `${result.data.tag}.sql`);
48435
+ const snapshotFilePath = (0, import_path5.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
45747
48436
  (0, import_fs9.rmSync)(sqlFilePath);
45748
48437
  (0, import_fs9.rmSync)(snapshotFilePath);
45749
48438
  (0, import_fs9.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
@@ -45758,13 +48447,13 @@ var printVersions = () => {
45758
48447
  var assertEitherConfigOrOut = (config, out) => {
45759
48448
  if (out)
45760
48449
  return out;
45761
- if (!(0, import_fs10.existsSync)(import_path8.default.join(import_path8.default.resolve(config)))) {
48450
+ if (!(0, import_fs10.existsSync)(import_path6.default.join(import_path6.default.resolve(config)))) {
45762
48451
  console.log(`${config} file does not exist`);
45763
48452
  process.exit(1);
45764
48453
  }
45765
48454
  console.log(`Reading ${config}`);
45766
48455
  const drizzleConfig = JSON.parse(
45767
- import_fs10.default.readFileSync(import_path8.default.join(import_path8.default.resolve(config))).toString()
48456
+ import_fs10.default.readFileSync(import_path6.default.join(import_path6.default.resolve(config))).toString()
45768
48457
  );
45769
48458
  return drizzleConfig.out;
45770
48459
  };
@@ -45776,22 +48465,23 @@ drizzle-orm: v${npmVersion}` : "";
45776
48465
  return versions2;
45777
48466
  };
45778
48467
  var configSchema = objectType({
45779
- schema: stringType(),
48468
+ schema: unionType([stringType(), stringType().array()]),
45780
48469
  out: stringType().default("drizzle"),
45781
48470
  breakpoints: booleanType()
45782
48471
  }).strict();
45783
48472
  var optionsSchema = objectType({
45784
- schema: stringType().optional(),
48473
+ schema: unionType([stringType(), stringType().array()]).optional(),
45785
48474
  out: stringType().optional(),
45786
48475
  config: stringType().optional(),
45787
48476
  breakpoints: booleanType().optional().default(false)
45788
48477
  }).strict();
45789
- var generatePgCommand = new Command("generate:pg").option("--schema <schema>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
48478
+ var generatePgCommand = new Command("generate:pg").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
45790
48479
  "--config <config>",
45791
48480
  "Path to a config.json file, drizzle.config.json by default"
45792
48481
  ).action(async (options) => {
45793
48482
  printVersions();
45794
48483
  assertOrmCoreVersion();
48484
+ console.log(options);
45795
48485
  const oprtionsParsed = optionsSchema.parse(options);
45796
48486
  const result = prepareGenerateConfig(oprtionsParsed);
45797
48487
  if (result instanceof Error) {
@@ -45802,7 +48492,7 @@ var generatePgCommand = new Command("generate:pg").option("--schema <schema>", "
45802
48492
  const { prepareAndMigratePg: prepareAndMigratePg2 } = (init_migrate(), __toCommonJS(migrate_exports));
45803
48493
  await prepareAndMigratePg2(result);
45804
48494
  });
45805
- var generateMysqlCommand = new Command("generate:mysql").option("--schema <schema>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
48495
+ var generateMysqlCommand = new Command("generate:mysql").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
45806
48496
  "--config <config>",
45807
48497
  "Path to a config.json file, drizzle.config.json by default"
45808
48498
  ).action(async (options) => {
@@ -45818,7 +48508,7 @@ var generateMysqlCommand = new Command("generate:mysql").option("--schema <schem
45818
48508
  const { prepareAndMigrateMySql: prepareAndMigrateMySql2 } = (init_migrate(), __toCommonJS(migrate_exports));
45819
48509
  await prepareAndMigrateMySql2(result);
45820
48510
  });
45821
- var generateSqliteCommand = new Command("generate:sqlite").option("--schema <schema>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
48511
+ var generateSqliteCommand = new Command("generate:sqlite").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
45822
48512
  "--config <config>",
45823
48513
  "Path to a config.json file, drizzle.config.json by default"
45824
48514
  ).action(async (options) => {
@@ -45837,9 +48527,9 @@ var generateSqliteCommand = new Command("generate:sqlite").option("--schema <sch
45837
48527
  var prepareGenerateConfig = (options) => {
45838
48528
  const { schema: schema4, out, config, breakpoints } = options;
45839
48529
  if (!(schema4 || out)) {
45840
- const path4 = config != null ? config : "drizzle.config.json";
48530
+ const path2 = config != null ? config : "drizzle.config.json";
45841
48531
  const drizzleConfig = JSON.parse(
45842
- import_fs10.default.readFileSync(import_path8.default.join(import_path8.default.resolve(path4))).toString()
48532
+ import_fs10.default.readFileSync(import_path6.default.join(import_path6.default.resolve(path2))).toString()
45843
48533
  );
45844
48534
  return drizzleConfig;
45845
48535
  }
@@ -45925,6 +48615,8 @@ var upSqliteCommand = new Command("up:sqlite").option("--out <out>", `Output fol
45925
48615
  console.log(error(`'out' folder param must be set`));
45926
48616
  process.exit(0);
45927
48617
  }
48618
+ upSqliteHandlerV4(out);
48619
+ upgradeFolders("sqlite", out);
45928
48620
  upSqliteHandler(out);
45929
48621
  });
45930
48622
  var pt1 = objectType({
@@ -45947,7 +48639,7 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
45947
48639
  }
45948
48640
  const { snapshots, journal } = prepareOutFolder(res.data.out, "pg");
45949
48641
  const { schema: schema4, ts } = await pgIntrospect2(res.data);
45950
- const schemaFile = import_path8.default.join(res.data.out, "schema.ts");
48642
+ const schemaFile = import_path6.default.join(res.data.out, "schema.ts");
45951
48643
  (0, import_fs10.writeFileSync)(schemaFile, ts);
45952
48644
  console.log();
45953
48645
  if (snapshots.length === 0) {
@@ -45996,7 +48688,7 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
45996
48688
  }
45997
48689
  const { snapshots, journal } = prepareOutFolder(res.data.out, "mysql");
45998
48690
  const { schema: schema4, ts } = await mysqlIntrospect2(res.data);
45999
- const schemaFile = import_path8.default.join(res.data.out, "schema.ts");
48691
+ const schemaFile = import_path6.default.join(res.data.out, "schema.ts");
46000
48692
  (0, import_fs10.writeFileSync)(schemaFile, ts);
46001
48693
  console.log();
46002
48694
  if (snapshots.length === 0) {