drizzle-kit 0.16.9-fc33d4a → 0.16.9-fcedf83

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 +2817 -119
  2. package/package.json +7 -4
  3. package/utils.js +232 -14
package/index.js CHANGED
@@ -5947,7 +5947,7 @@ var require_hanji = __commonJS({
5947
5947
  }
5948
5948
  };
5949
5949
  exports.TaskTerminal = TaskTerminal;
5950
- function render4(view) {
5950
+ function render5(view) {
5951
5951
  const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
5952
5952
  if (view instanceof Prompt2) {
5953
5953
  const terminal = new Terminal(view, stdin, stdout, closable);
@@ -5959,7 +5959,7 @@ var require_hanji = __commonJS({
5959
5959
  closable.close();
5960
5960
  return;
5961
5961
  }
5962
- exports.render = render4;
5962
+ exports.render = render5;
5963
5963
  function renderWithTask3(view, task) {
5964
5964
  return __awaiter(this, void 0, void 0, function* () {
5965
5965
  const terminal = new TaskTerminal(view, process.stdout);
@@ -5979,7 +5979,7 @@ var require_hanji = __commonJS({
5979
5979
  });
5980
5980
 
5981
5981
  // src/cli/views.ts
5982
- var import_hanji, err, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect, Spinner, IntrospectProgress;
5982
+ var import_hanji, err, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, DropMigrationView, trimmedRange;
5983
5983
  var init_views = __esm({
5984
5984
  "src/cli/views.ts"() {
5985
5985
  init_source();
@@ -6242,6 +6242,60 @@ Is ${source_default.bold.blue(
6242
6242
  return info2;
6243
6243
  }
6244
6244
  };
6245
+ DropMigrationView = class extends import_hanji.Prompt {
6246
+ constructor(data) {
6247
+ super();
6248
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
6249
+ this.data = new import_hanji.SelectState(data);
6250
+ this.data.selectedIdx = data.length - 1;
6251
+ this.data.bind(this);
6252
+ }
6253
+ render(status) {
6254
+ if (status === "submitted" || status === "aborted") {
6255
+ return "\n";
6256
+ }
6257
+ let text = source_default.bold("Please select migration to drop:\n");
6258
+ const selectedPrefix = source_default.yellow("\u276F ");
6259
+ const data = trimmedRange(this.data.items, this.data.selectedIdx, 9);
6260
+ const labelLength = data.trimmed.map((it) => it.tag.length).reduce((a, b) => {
6261
+ if (a > b) {
6262
+ return a;
6263
+ }
6264
+ return b;
6265
+ }, 0);
6266
+ text += data.startTrimmed ? " ...\n" : "";
6267
+ data.trimmed.forEach((it, idx) => {
6268
+ const isSelected = idx === this.data.selectedIdx - data.offset;
6269
+ let title = it.tag.padEnd(labelLength, " ");
6270
+ title = isSelected ? source_default.yellow(title) : title;
6271
+ text += isSelected ? `${selectedPrefix}${title}` : ` ${title}`;
6272
+ text += idx != this.data.items.length - 1 ? "\n" : "";
6273
+ });
6274
+ text += data.endTrimmed ? " ...\n" : "";
6275
+ return text;
6276
+ }
6277
+ result() {
6278
+ return this.data.items[this.data.selectedIdx];
6279
+ }
6280
+ };
6281
+ trimmedRange = (arr, index4, limitLines) => {
6282
+ const limit = limitLines - 2;
6283
+ const sideLimit = Math.round(limit / 2);
6284
+ const endTrimmed = arr.length - sideLimit > index4;
6285
+ const startTrimmed = index4 > sideLimit - 1;
6286
+ const paddingStart = Math.max(index4 + sideLimit - arr.length, 0);
6287
+ const paddingEnd = Math.min(index4 - sideLimit + 1, 0);
6288
+ const d1 = endTrimmed ? 1 : 0;
6289
+ const d2 = startTrimmed ? 0 : 1;
6290
+ const start = Math.max(0, index4 - sideLimit + d1 - paddingStart);
6291
+ const end = Math.min(arr.length, index4 + sideLimit + d2 - paddingEnd);
6292
+ return {
6293
+ trimmed: arr.slice(start, end),
6294
+ offset: start,
6295
+ startTrimmed,
6296
+ endTrimmed
6297
+ };
6298
+ };
6245
6299
  }
6246
6300
  });
6247
6301
 
@@ -6284,7 +6338,8 @@ var init_mysqlSchema = __esm({
6284
6338
  primaryKey: booleanType(),
6285
6339
  notNull: booleanType(),
6286
6340
  autoincrement: booleanType().optional(),
6287
- default: anyType().optional()
6341
+ default: anyType().optional(),
6342
+ onUpdate: anyType().optional()
6288
6343
  }).strict();
6289
6344
  tableV3 = objectType({
6290
6345
  name: stringType(),
@@ -11495,7 +11550,7 @@ var require_bare = __commonJS({
11495
11550
  var sgr = require_sgr();
11496
11551
  var supportsColor2 = require_supports_color();
11497
11552
  var mods = sgr.mods;
11498
- var join4 = Array.prototype.join;
11553
+ var join5 = Array.prototype.join;
11499
11554
  var defineProperty = Object.defineProperty;
11500
11555
  var max = Math.max;
11501
11556
  var min = Math.min;
@@ -11549,7 +11604,7 @@ var require_bare = __commonJS({
11549
11604
  getFn = function() {
11550
11605
  return setPrototypeOf(
11551
11606
  function self2() {
11552
- var start = "", end = "", msg = join4.call(arguments, " "), conf = self2._cliColorData, hasAnsi = sgr.hasCSI(msg);
11607
+ var start = "", end = "", msg = join5.call(arguments, " "), conf = self2._cliColorData, hasAnsi = sgr.hasCSI(msg);
11553
11608
  forEach(
11554
11609
  conf,
11555
11610
  function(mod, key) {
@@ -13150,6 +13205,32 @@ var init_jsonDiffer = __esm({
13150
13205
  return { ...others, notNull: { type: "deleted", value: it.notNull__deleted } };
13151
13206
  }
13152
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;
13153
13234
  });
13154
13235
  return result[0];
13155
13236
  };
@@ -13157,7 +13238,7 @@ var init_jsonDiffer = __esm({
13157
13238
  });
13158
13239
 
13159
13240
  // src/sqlgenerator.ts
13160
- 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;
13161
13242
  var init_sqlgenerator = __esm({
13162
13243
  "src/sqlgenerator.ts"() {
13163
13244
  init_mysqlSchema();
@@ -13239,8 +13320,9 @@ var init_sqlgenerator = __esm({
13239
13320
  const primaryKeyStatement = column6.primaryKey ? "PRIMARY KEY" : "";
13240
13321
  const notNullStatement = column6.notNull ? "NOT NULL" : "";
13241
13322
  const defaultStatement = column6.default !== void 0 ? `DEFAULT ${column6.default}` : "";
13323
+ const onUpdateStatement = column6.onUpdate ? `ON UPDATE CURRENT_TIMESTAMP` : "";
13242
13324
  const autoincrementStatement = column6.autoincrement ? "AUTO_INCREMENT" : "";
13243
- 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();
13244
13326
  statement += (i === columns.length - 1 ? "" : ",") + "\n";
13245
13327
  }
13246
13328
  statement += `);`;
@@ -13524,6 +13606,82 @@ var init_sqlgenerator = __esm({
13524
13606
  return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
13525
13607
  }
13526
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
+ };
13527
13685
  SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
13528
13686
  can(statement, dialect6) {
13529
13687
  return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "sqlite";
@@ -13975,6 +14133,16 @@ var init_sqlgenerator = __esm({
13975
14133
  `;
13976
14134
  }
13977
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
+ };
13978
14146
  convertors = [];
13979
14147
  convertors.push(new PgCreateTableConvertor());
13980
14148
  convertors.push(new MySqlCreateTableConvertor());
@@ -13999,11 +14167,15 @@ var init_sqlgenerator = __esm({
13999
14167
  convertors.push(new CreateSqliteIndexConvertor());
14000
14168
  convertors.push(new PgDropIndexConvertor());
14001
14169
  convertors.push(new SqliteDropIndexConvertor());
14170
+ convertors.push(new MySqlDropIndexConvertor());
14002
14171
  convertors.push(new AlterTypeAddValueConvertor());
14003
14172
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
14004
14173
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
14005
14174
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
14006
14175
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
14176
+ convertors.push(new MySqlModifyColumn());
14177
+ convertors.push(new MySqlAlterTableAlterColumnSetDefaultConvertor());
14178
+ convertors.push(new MySqlAlterTableAlterColumnDropDefaultConvertor());
14007
14179
  convertors.push(new PgCreateForeignKeyConvertor());
14008
14180
  convertors.push(new MySqlCreateForeignKeyConvertor());
14009
14181
  convertors.push(new PgAlterForeignKeyConvertor());
@@ -14038,7 +14210,7 @@ var init_sqlgenerator = __esm({
14038
14210
  });
14039
14211
  const convertor = filtered.length === 1 ? filtered[0] : void 0;
14040
14212
  if (!convertor) {
14041
- console.log("no convertor:", statement.type);
14213
+ console.log("no convertor:", statement.type, dialect6);
14042
14214
  return "dry run";
14043
14215
  }
14044
14216
  return convertor.convert(statement);
@@ -14168,10 +14340,10 @@ var init_jsonStatements = __esm({
14168
14340
  };
14169
14341
  });
14170
14342
  };
14171
- prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, dialect6) => {
14343
+ prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, json2, dialect6) => {
14172
14344
  const addColumns = [];
14173
14345
  const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
14174
- const alterColumns = _prepareAlterColumns(tableName, schema4, altered);
14346
+ const alterColumns = _prepareAlterColumns(tableName, schema4, altered, json2);
14175
14347
  if (dialect6 === "sqlite") {
14176
14348
  let jsonCreateFKStatements = Object.values(addedFk);
14177
14349
  const sqliteAddColumns = _prepareSQLiteAddColumns(
@@ -14221,11 +14393,16 @@ var init_jsonStatements = __esm({
14221
14393
  };
14222
14394
  });
14223
14395
  };
14224
- _prepareAlterColumns = (tableName, schema4, columns) => {
14225
- 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;
14226
14398
  let statements = [];
14227
14399
  for (const column6 of columns) {
14228
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;
14229
14406
  if (typeof column6.name !== "string") {
14230
14407
  statements.push({
14231
14408
  type: "alter_table_rename_column",
@@ -14241,7 +14418,11 @@ var init_jsonStatements = __esm({
14241
14418
  tableName,
14242
14419
  columnName,
14243
14420
  newDataType: column6.type.new,
14244
- schema: schema4
14421
+ schema: schema4,
14422
+ columnDefault,
14423
+ columnOnUpdate,
14424
+ columnNotNull,
14425
+ columnAutoIncrement
14245
14426
  });
14246
14427
  }
14247
14428
  if (((_b = column6.default) == null ? void 0 : _b.type) === "added") {
@@ -14275,7 +14456,12 @@ var init_jsonStatements = __esm({
14275
14456
  type: "alter_table_alter_column_set_notnull",
14276
14457
  tableName,
14277
14458
  columnName,
14278
- schema: schema4
14459
+ schema: schema4,
14460
+ newDataType: columnType,
14461
+ columnDefault,
14462
+ columnOnUpdate,
14463
+ columnNotNull,
14464
+ columnAutoIncrement
14279
14465
  });
14280
14466
  }
14281
14467
  if (((_f = column6.notNull) == null ? void 0 : _f.type) === "changed") {
@@ -14284,7 +14470,12 @@ var init_jsonStatements = __esm({
14284
14470
  type,
14285
14471
  tableName,
14286
14472
  columnName,
14287
- schema: schema4
14473
+ schema: schema4,
14474
+ newDataType: columnType,
14475
+ columnDefault,
14476
+ columnOnUpdate,
14477
+ columnNotNull,
14478
+ columnAutoIncrement
14288
14479
  });
14289
14480
  }
14290
14481
  if (((_g = column6.notNull) == null ? void 0 : _g.type) === "deleted") {
@@ -14292,7 +14483,78 @@ var init_jsonStatements = __esm({
14292
14483
  type: "alter_table_alter_column_drop_notnull",
14293
14484
  tableName,
14294
14485
  columnName,
14295
- 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
14296
14558
  });
14297
14559
  }
14298
14560
  }
@@ -14463,13 +14725,16 @@ var init_snapshotsDiffer = __esm({
14463
14725
  unique: booleanType().optional(),
14464
14726
  default: anyType().optional(),
14465
14727
  notNull: booleanType().optional(),
14466
- autoincrement: booleanType().optional()
14728
+ autoincrement: booleanType().optional(),
14729
+ onUpdate: booleanType().optional()
14467
14730
  }).strict();
14468
14731
  alteredColumnSchema = objectType({
14469
14732
  name: makeSelfOrChanged(stringType()),
14470
14733
  type: makeChanged(stringType()).optional(),
14471
14734
  default: makePatched(anyType()).optional(),
14472
- notNull: makePatched(booleanType()).optional()
14735
+ notNull: makePatched(booleanType()).optional(),
14736
+ onUpdate: makePatched(booleanType()).optional(),
14737
+ autoincrement: makePatched(booleanType()).optional()
14473
14738
  }).strict();
14474
14739
  enumSchema2 = objectType({
14475
14740
  name: stringType(),
@@ -14677,6 +14942,7 @@ var init_snapshotsDiffer = __esm({
14677
14942
  it.added,
14678
14943
  it.altered,
14679
14944
  it.addedForeignKeys,
14945
+ json2,
14680
14946
  dialect6
14681
14947
  );
14682
14948
  }).flat().reduce(
@@ -14771,8 +15037,14 @@ var init_snapshotsDiffer = __esm({
14771
15037
  jsonStatements.push(...jsonRemoveTableFromSchemas);
14772
15038
  jsonStatements.push(...dropSchemas);
14773
15039
  const sqlStatements = fromJson(jsonStatements, dialect6);
15040
+ const uniqueSqlStatements = [];
15041
+ sqlStatements.forEach((ss) => {
15042
+ if (!uniqueSqlStatements.includes(ss)) {
15043
+ uniqueSqlStatements.push(ss);
15044
+ }
15045
+ });
14774
15046
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
14775
- return { statements: jsonStatements, sqlStatements, _meta };
15047
+ return { statements: jsonStatements, sqlStatements: uniqueSqlStatements, _meta };
14776
15048
  };
14777
15049
  }
14778
15050
  });
@@ -19760,7 +20032,7 @@ var require_node2 = __commonJS({
19760
20032
  resolve(data);
19761
20033
  });
19762
20034
  });
19763
- var readFileSync3 = (fp) => {
20035
+ var readFileSync4 = (fp) => {
19764
20036
  return _fs.default.readFileSync(fp, "utf8");
19765
20037
  };
19766
20038
  var pathExists = (fp) => new Promise((resolve) => {
@@ -19991,7 +20263,7 @@ var require_node2 = __commonJS({
19991
20263
  data: this.packageJsonCache.get(filepath)[options.packageKey]
19992
20264
  };
19993
20265
  }
19994
- const data = this.options.parseJSON(readFileSync3(filepath));
20266
+ const data = this.options.parseJSON(readFileSync4(filepath));
19995
20267
  return {
19996
20268
  path: filepath,
19997
20269
  data
@@ -19999,7 +20271,7 @@ var require_node2 = __commonJS({
19999
20271
  }
20000
20272
  return {
20001
20273
  path: filepath,
20002
- data: readFileSync3(filepath)
20274
+ data: readFileSync4(filepath)
20003
20275
  };
20004
20276
  }
20005
20277
  return {};
@@ -21621,19 +21893,19 @@ var require_node2 = __commonJS({
21621
21893
  return walkForTsConfig(parentDirectory, existsSync4);
21622
21894
  }
21623
21895
  exports2.walkForTsConfig = walkForTsConfig;
21624
- function loadTsconfig(configFilePath, existsSync4, readFileSync3) {
21896
+ function loadTsconfig(configFilePath, existsSync4, readFileSync4) {
21625
21897
  if (existsSync4 === void 0) {
21626
21898
  existsSync4 = fs32.existsSync;
21627
21899
  }
21628
- if (readFileSync3 === void 0) {
21629
- readFileSync3 = function(filename) {
21900
+ if (readFileSync4 === void 0) {
21901
+ readFileSync4 = function(filename) {
21630
21902
  return fs32.readFileSync(filename, "utf8");
21631
21903
  };
21632
21904
  }
21633
21905
  if (!existsSync4(configFilePath)) {
21634
21906
  return void 0;
21635
21907
  }
21636
- var configString = readFileSync3(configFilePath);
21908
+ var configString = readFileSync4(configFilePath);
21637
21909
  var cleanedJson = StripBom(configString);
21638
21910
  var config = JSON5.parse(cleanedJson);
21639
21911
  var extendedConfig = config.extends;
@@ -21646,7 +21918,7 @@ var require_node2 = __commonJS({
21646
21918
  if (extendedConfig.indexOf("/") !== -1 && extendedConfig.indexOf(".") !== -1 && !existsSync4(extendedConfigPath)) {
21647
21919
  extendedConfigPath = path4.join(currentDir, "node_modules", extendedConfig);
21648
21920
  }
21649
- var base = loadTsconfig(extendedConfigPath, existsSync4, readFileSync3) || {};
21921
+ var base = loadTsconfig(extendedConfigPath, existsSync4, readFileSync4) || {};
21650
21922
  if (base.compilerOptions && base.compilerOptions.baseUrl) {
21651
21923
  var extendsDir = path4.dirname(extendedConfig);
21652
21924
  base.compilerOptions.baseUrl = path4.join(extendsDir, base.compilerOptions.baseUrl);
@@ -22283,6 +22555,2337 @@ var require_node2 = __commonJS({
22283
22555
  }
22284
22556
  });
22285
22557
 
22558
+ // node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
22559
+ var require_old = __commonJS({
22560
+ "node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports) {
22561
+ var pathModule = require("path");
22562
+ var isWindows = process.platform === "win32";
22563
+ var fs7 = require("fs");
22564
+ var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
22565
+ function rethrow() {
22566
+ var callback;
22567
+ if (DEBUG) {
22568
+ var backtrace = new Error();
22569
+ callback = debugCallback;
22570
+ } else
22571
+ callback = missingCallback;
22572
+ return callback;
22573
+ function debugCallback(err2) {
22574
+ if (err2) {
22575
+ backtrace.message = err2.message;
22576
+ err2 = backtrace;
22577
+ missingCallback(err2);
22578
+ }
22579
+ }
22580
+ function missingCallback(err2) {
22581
+ if (err2) {
22582
+ if (process.throwDeprecation)
22583
+ throw err2;
22584
+ else if (!process.noDeprecation) {
22585
+ var msg = "fs: missing callback " + (err2.stack || err2.message);
22586
+ if (process.traceDeprecation)
22587
+ console.trace(msg);
22588
+ else
22589
+ console.error(msg);
22590
+ }
22591
+ }
22592
+ }
22593
+ }
22594
+ function maybeCallback(cb) {
22595
+ return typeof cb === "function" ? cb : rethrow();
22596
+ }
22597
+ var normalize = pathModule.normalize;
22598
+ if (isWindows) {
22599
+ nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
22600
+ } else {
22601
+ nextPartRe = /(.*?)(?:[\/]+|$)/g;
22602
+ }
22603
+ var nextPartRe;
22604
+ if (isWindows) {
22605
+ splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
22606
+ } else {
22607
+ splitRootRe = /^[\/]*/;
22608
+ }
22609
+ var splitRootRe;
22610
+ exports.realpathSync = function realpathSync(p, cache) {
22611
+ p = pathModule.resolve(p);
22612
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
22613
+ return cache[p];
22614
+ }
22615
+ var original = p, seenLinks = {}, knownHard = {};
22616
+ var pos;
22617
+ var current;
22618
+ var base;
22619
+ var previous;
22620
+ start();
22621
+ function start() {
22622
+ var m = splitRootRe.exec(p);
22623
+ pos = m[0].length;
22624
+ current = m[0];
22625
+ base = m[0];
22626
+ previous = "";
22627
+ if (isWindows && !knownHard[base]) {
22628
+ fs7.lstatSync(base);
22629
+ knownHard[base] = true;
22630
+ }
22631
+ }
22632
+ while (pos < p.length) {
22633
+ nextPartRe.lastIndex = pos;
22634
+ var result = nextPartRe.exec(p);
22635
+ previous = current;
22636
+ current += result[0];
22637
+ base = previous + result[1];
22638
+ pos = nextPartRe.lastIndex;
22639
+ if (knownHard[base] || cache && cache[base] === base) {
22640
+ continue;
22641
+ }
22642
+ var resolvedLink;
22643
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
22644
+ resolvedLink = cache[base];
22645
+ } else {
22646
+ var stat = fs7.lstatSync(base);
22647
+ if (!stat.isSymbolicLink()) {
22648
+ knownHard[base] = true;
22649
+ if (cache)
22650
+ cache[base] = base;
22651
+ continue;
22652
+ }
22653
+ var linkTarget = null;
22654
+ if (!isWindows) {
22655
+ var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
22656
+ if (seenLinks.hasOwnProperty(id)) {
22657
+ linkTarget = seenLinks[id];
22658
+ }
22659
+ }
22660
+ if (linkTarget === null) {
22661
+ fs7.statSync(base);
22662
+ linkTarget = fs7.readlinkSync(base);
22663
+ }
22664
+ resolvedLink = pathModule.resolve(previous, linkTarget);
22665
+ if (cache)
22666
+ cache[base] = resolvedLink;
22667
+ if (!isWindows)
22668
+ seenLinks[id] = linkTarget;
22669
+ }
22670
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
22671
+ start();
22672
+ }
22673
+ if (cache)
22674
+ cache[original] = p;
22675
+ return p;
22676
+ };
22677
+ exports.realpath = function realpath(p, cache, cb) {
22678
+ if (typeof cb !== "function") {
22679
+ cb = maybeCallback(cache);
22680
+ cache = null;
22681
+ }
22682
+ p = pathModule.resolve(p);
22683
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
22684
+ return process.nextTick(cb.bind(null, null, cache[p]));
22685
+ }
22686
+ var original = p, seenLinks = {}, knownHard = {};
22687
+ var pos;
22688
+ var current;
22689
+ var base;
22690
+ var previous;
22691
+ start();
22692
+ function start() {
22693
+ var m = splitRootRe.exec(p);
22694
+ pos = m[0].length;
22695
+ current = m[0];
22696
+ base = m[0];
22697
+ previous = "";
22698
+ if (isWindows && !knownHard[base]) {
22699
+ fs7.lstat(base, function(err2) {
22700
+ if (err2)
22701
+ return cb(err2);
22702
+ knownHard[base] = true;
22703
+ LOOP();
22704
+ });
22705
+ } else {
22706
+ process.nextTick(LOOP);
22707
+ }
22708
+ }
22709
+ function LOOP() {
22710
+ if (pos >= p.length) {
22711
+ if (cache)
22712
+ cache[original] = p;
22713
+ return cb(null, p);
22714
+ }
22715
+ nextPartRe.lastIndex = pos;
22716
+ var result = nextPartRe.exec(p);
22717
+ previous = current;
22718
+ current += result[0];
22719
+ base = previous + result[1];
22720
+ pos = nextPartRe.lastIndex;
22721
+ if (knownHard[base] || cache && cache[base] === base) {
22722
+ return process.nextTick(LOOP);
22723
+ }
22724
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
22725
+ return gotResolvedLink(cache[base]);
22726
+ }
22727
+ return fs7.lstat(base, gotStat);
22728
+ }
22729
+ function gotStat(err2, stat) {
22730
+ if (err2)
22731
+ return cb(err2);
22732
+ if (!stat.isSymbolicLink()) {
22733
+ knownHard[base] = true;
22734
+ if (cache)
22735
+ cache[base] = base;
22736
+ return process.nextTick(LOOP);
22737
+ }
22738
+ if (!isWindows) {
22739
+ var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
22740
+ if (seenLinks.hasOwnProperty(id)) {
22741
+ return gotTarget(null, seenLinks[id], base);
22742
+ }
22743
+ }
22744
+ fs7.stat(base, function(err3) {
22745
+ if (err3)
22746
+ return cb(err3);
22747
+ fs7.readlink(base, function(err4, target) {
22748
+ if (!isWindows)
22749
+ seenLinks[id] = target;
22750
+ gotTarget(err4, target);
22751
+ });
22752
+ });
22753
+ }
22754
+ function gotTarget(err2, target, base2) {
22755
+ if (err2)
22756
+ return cb(err2);
22757
+ var resolvedLink = pathModule.resolve(previous, target);
22758
+ if (cache)
22759
+ cache[base2] = resolvedLink;
22760
+ gotResolvedLink(resolvedLink);
22761
+ }
22762
+ function gotResolvedLink(resolvedLink) {
22763
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
22764
+ start();
22765
+ }
22766
+ };
22767
+ }
22768
+ });
22769
+
22770
+ // node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js
22771
+ var require_fs = __commonJS({
22772
+ "node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js"(exports, module2) {
22773
+ module2.exports = realpath;
22774
+ realpath.realpath = realpath;
22775
+ realpath.sync = realpathSync;
22776
+ realpath.realpathSync = realpathSync;
22777
+ realpath.monkeypatch = monkeypatch;
22778
+ realpath.unmonkeypatch = unmonkeypatch;
22779
+ var fs7 = require("fs");
22780
+ var origRealpath = fs7.realpath;
22781
+ var origRealpathSync = fs7.realpathSync;
22782
+ var version = process.version;
22783
+ var ok = /^v[0-5]\./.test(version);
22784
+ var old = require_old();
22785
+ function newError(er) {
22786
+ return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
22787
+ }
22788
+ function realpath(p, cache, cb) {
22789
+ if (ok) {
22790
+ return origRealpath(p, cache, cb);
22791
+ }
22792
+ if (typeof cache === "function") {
22793
+ cb = cache;
22794
+ cache = null;
22795
+ }
22796
+ origRealpath(p, cache, function(er, result) {
22797
+ if (newError(er)) {
22798
+ old.realpath(p, cache, cb);
22799
+ } else {
22800
+ cb(er, result);
22801
+ }
22802
+ });
22803
+ }
22804
+ function realpathSync(p, cache) {
22805
+ if (ok) {
22806
+ return origRealpathSync(p, cache);
22807
+ }
22808
+ try {
22809
+ return origRealpathSync(p, cache);
22810
+ } catch (er) {
22811
+ if (newError(er)) {
22812
+ return old.realpathSync(p, cache);
22813
+ } else {
22814
+ throw er;
22815
+ }
22816
+ }
22817
+ }
22818
+ function monkeypatch() {
22819
+ fs7.realpath = realpath;
22820
+ fs7.realpathSync = realpathSync;
22821
+ }
22822
+ function unmonkeypatch() {
22823
+ fs7.realpath = origRealpath;
22824
+ fs7.realpathSync = origRealpathSync;
22825
+ }
22826
+ }
22827
+ });
22828
+
22829
+ // node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js
22830
+ var require_path = __commonJS({
22831
+ "node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports, module2) {
22832
+ var isWindows = typeof process === "object" && process && process.platform === "win32";
22833
+ module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
22834
+ }
22835
+ });
22836
+
22837
+ // node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
22838
+ var require_balanced_match = __commonJS({
22839
+ "node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module2) {
22840
+ "use strict";
22841
+ module2.exports = balanced;
22842
+ function balanced(a, b, str) {
22843
+ if (a instanceof RegExp)
22844
+ a = maybeMatch(a, str);
22845
+ if (b instanceof RegExp)
22846
+ b = maybeMatch(b, str);
22847
+ var r = range(a, b, str);
22848
+ return r && {
22849
+ start: r[0],
22850
+ end: r[1],
22851
+ pre: str.slice(0, r[0]),
22852
+ body: str.slice(r[0] + a.length, r[1]),
22853
+ post: str.slice(r[1] + b.length)
22854
+ };
22855
+ }
22856
+ function maybeMatch(reg, str) {
22857
+ var m = str.match(reg);
22858
+ return m ? m[0] : null;
22859
+ }
22860
+ balanced.range = range;
22861
+ function range(a, b, str) {
22862
+ var begs, beg, left, right, result;
22863
+ var ai = str.indexOf(a);
22864
+ var bi = str.indexOf(b, ai + 1);
22865
+ var i = ai;
22866
+ if (ai >= 0 && bi > 0) {
22867
+ if (a === b) {
22868
+ return [ai, bi];
22869
+ }
22870
+ begs = [];
22871
+ left = str.length;
22872
+ while (i >= 0 && !result) {
22873
+ if (i == ai) {
22874
+ begs.push(i);
22875
+ ai = str.indexOf(a, i + 1);
22876
+ } else if (begs.length == 1) {
22877
+ result = [begs.pop(), bi];
22878
+ } else {
22879
+ beg = begs.pop();
22880
+ if (beg < left) {
22881
+ left = beg;
22882
+ right = bi;
22883
+ }
22884
+ bi = str.indexOf(b, i + 1);
22885
+ }
22886
+ i = ai < bi && ai >= 0 ? ai : bi;
22887
+ }
22888
+ if (begs.length) {
22889
+ result = [left, right];
22890
+ }
22891
+ }
22892
+ return result;
22893
+ }
22894
+ }
22895
+ });
22896
+
22897
+ // node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
22898
+ var require_brace_expansion = __commonJS({
22899
+ "node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module2) {
22900
+ var balanced = require_balanced_match();
22901
+ module2.exports = expandTop;
22902
+ var escSlash = "\0SLASH" + Math.random() + "\0";
22903
+ var escOpen = "\0OPEN" + Math.random() + "\0";
22904
+ var escClose = "\0CLOSE" + Math.random() + "\0";
22905
+ var escComma = "\0COMMA" + Math.random() + "\0";
22906
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
22907
+ function numeric(str) {
22908
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
22909
+ }
22910
+ function escapeBraces(str) {
22911
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
22912
+ }
22913
+ function unescapeBraces(str) {
22914
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
22915
+ }
22916
+ function parseCommaParts(str) {
22917
+ if (!str)
22918
+ return [""];
22919
+ var parts = [];
22920
+ var m = balanced("{", "}", str);
22921
+ if (!m)
22922
+ return str.split(",");
22923
+ var pre = m.pre;
22924
+ var body = m.body;
22925
+ var post = m.post;
22926
+ var p = pre.split(",");
22927
+ p[p.length - 1] += "{" + body + "}";
22928
+ var postParts = parseCommaParts(post);
22929
+ if (post.length) {
22930
+ p[p.length - 1] += postParts.shift();
22931
+ p.push.apply(p, postParts);
22932
+ }
22933
+ parts.push.apply(parts, p);
22934
+ return parts;
22935
+ }
22936
+ function expandTop(str) {
22937
+ if (!str)
22938
+ return [];
22939
+ if (str.substr(0, 2) === "{}") {
22940
+ str = "\\{\\}" + str.substr(2);
22941
+ }
22942
+ return expand(escapeBraces(str), true).map(unescapeBraces);
22943
+ }
22944
+ function embrace(str) {
22945
+ return "{" + str + "}";
22946
+ }
22947
+ function isPadded(el) {
22948
+ return /^-?0\d/.test(el);
22949
+ }
22950
+ function lte(i, y) {
22951
+ return i <= y;
22952
+ }
22953
+ function gte(i, y) {
22954
+ return i >= y;
22955
+ }
22956
+ function expand(str, isTop) {
22957
+ var expansions = [];
22958
+ var m = balanced("{", "}", str);
22959
+ if (!m)
22960
+ return [str];
22961
+ var pre = m.pre;
22962
+ var post = m.post.length ? expand(m.post, false) : [""];
22963
+ if (/\$$/.test(m.pre)) {
22964
+ for (var k = 0; k < post.length; k++) {
22965
+ var expansion = pre + "{" + m.body + "}" + post[k];
22966
+ expansions.push(expansion);
22967
+ }
22968
+ } else {
22969
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
22970
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
22971
+ var isSequence = isNumericSequence || isAlphaSequence;
22972
+ var isOptions = m.body.indexOf(",") >= 0;
22973
+ if (!isSequence && !isOptions) {
22974
+ if (m.post.match(/,.*\}/)) {
22975
+ str = m.pre + "{" + m.body + escClose + m.post;
22976
+ return expand(str);
22977
+ }
22978
+ return [str];
22979
+ }
22980
+ var n;
22981
+ if (isSequence) {
22982
+ n = m.body.split(/\.\./);
22983
+ } else {
22984
+ n = parseCommaParts(m.body);
22985
+ if (n.length === 1) {
22986
+ n = expand(n[0], false).map(embrace);
22987
+ if (n.length === 1) {
22988
+ return post.map(function(p) {
22989
+ return m.pre + n[0] + p;
22990
+ });
22991
+ }
22992
+ }
22993
+ }
22994
+ var N;
22995
+ if (isSequence) {
22996
+ var x = numeric(n[0]);
22997
+ var y = numeric(n[1]);
22998
+ var width = Math.max(n[0].length, n[1].length);
22999
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
23000
+ var test = lte;
23001
+ var reverse = y < x;
23002
+ if (reverse) {
23003
+ incr *= -1;
23004
+ test = gte;
23005
+ }
23006
+ var pad = n.some(isPadded);
23007
+ N = [];
23008
+ for (var i = x; test(i, y); i += incr) {
23009
+ var c;
23010
+ if (isAlphaSequence) {
23011
+ c = String.fromCharCode(i);
23012
+ if (c === "\\")
23013
+ c = "";
23014
+ } else {
23015
+ c = String(i);
23016
+ if (pad) {
23017
+ var need = width - c.length;
23018
+ if (need > 0) {
23019
+ var z2 = new Array(need + 1).join("0");
23020
+ if (i < 0)
23021
+ c = "-" + z2 + c.slice(1);
23022
+ else
23023
+ c = z2 + c;
23024
+ }
23025
+ }
23026
+ }
23027
+ N.push(c);
23028
+ }
23029
+ } else {
23030
+ N = [];
23031
+ for (var j = 0; j < n.length; j++) {
23032
+ N.push.apply(N, expand(n[j], false));
23033
+ }
23034
+ }
23035
+ for (var j = 0; j < N.length; j++) {
23036
+ for (var k = 0; k < post.length; k++) {
23037
+ var expansion = pre + N[j] + post[k];
23038
+ if (!isTop || isSequence || expansion)
23039
+ expansions.push(expansion);
23040
+ }
23041
+ }
23042
+ }
23043
+ return expansions;
23044
+ }
23045
+ }
23046
+ });
23047
+
23048
+ // node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js
23049
+ var require_minimatch = __commonJS({
23050
+ "node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports, module2) {
23051
+ var minimatch = module2.exports = (p, pattern, options = {}) => {
23052
+ assertValidPattern(pattern);
23053
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23054
+ return false;
23055
+ }
23056
+ return new Minimatch(pattern, options).match(p);
23057
+ };
23058
+ module2.exports = minimatch;
23059
+ var path4 = require_path();
23060
+ minimatch.sep = path4.sep;
23061
+ var GLOBSTAR = Symbol("globstar **");
23062
+ minimatch.GLOBSTAR = GLOBSTAR;
23063
+ var expand = require_brace_expansion();
23064
+ var plTypes = {
23065
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
23066
+ "?": { open: "(?:", close: ")?" },
23067
+ "+": { open: "(?:", close: ")+" },
23068
+ "*": { open: "(?:", close: ")*" },
23069
+ "@": { open: "(?:", close: ")" }
23070
+ };
23071
+ var qmark = "[^/]";
23072
+ var star = qmark + "*?";
23073
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
23074
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
23075
+ var charSet = (s) => s.split("").reduce((set, c) => {
23076
+ set[c] = true;
23077
+ return set;
23078
+ }, {});
23079
+ var reSpecials = charSet("().*{}+?[]^$\\!");
23080
+ var addPatternStartSet = charSet("[.(");
23081
+ var slashSplit = /\/+/;
23082
+ minimatch.filter = (pattern, options = {}) => (p, i, list) => minimatch(p, pattern, options);
23083
+ var ext = (a, b = {}) => {
23084
+ const t = {};
23085
+ Object.keys(a).forEach((k) => t[k] = a[k]);
23086
+ Object.keys(b).forEach((k) => t[k] = b[k]);
23087
+ return t;
23088
+ };
23089
+ minimatch.defaults = (def) => {
23090
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
23091
+ return minimatch;
23092
+ }
23093
+ const orig = minimatch;
23094
+ const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
23095
+ m.Minimatch = class Minimatch extends orig.Minimatch {
23096
+ constructor(pattern, options) {
23097
+ super(pattern, ext(def, options));
23098
+ }
23099
+ };
23100
+ m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
23101
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
23102
+ m.defaults = (options) => orig.defaults(ext(def, options));
23103
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
23104
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
23105
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
23106
+ return m;
23107
+ };
23108
+ minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
23109
+ var braceExpand = (pattern, options = {}) => {
23110
+ assertValidPattern(pattern);
23111
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
23112
+ return [pattern];
23113
+ }
23114
+ return expand(pattern);
23115
+ };
23116
+ var MAX_PATTERN_LENGTH = 1024 * 64;
23117
+ var assertValidPattern = (pattern) => {
23118
+ if (typeof pattern !== "string") {
23119
+ throw new TypeError("invalid pattern");
23120
+ }
23121
+ if (pattern.length > MAX_PATTERN_LENGTH) {
23122
+ throw new TypeError("pattern is too long");
23123
+ }
23124
+ };
23125
+ var SUBPARSE = Symbol("subparse");
23126
+ minimatch.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
23127
+ minimatch.match = (list, pattern, options = {}) => {
23128
+ const mm = new Minimatch(pattern, options);
23129
+ list = list.filter((f) => mm.match(f));
23130
+ if (mm.options.nonull && !list.length) {
23131
+ list.push(pattern);
23132
+ }
23133
+ return list;
23134
+ };
23135
+ var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
23136
+ var charUnescape = (s) => s.replace(/\\([^-\]])/g, "$1");
23137
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
23138
+ var braExpEscape = (s) => s.replace(/[[\]\\]/g, "\\$&");
23139
+ var Minimatch = class {
23140
+ constructor(pattern, options) {
23141
+ assertValidPattern(pattern);
23142
+ if (!options)
23143
+ options = {};
23144
+ this.options = options;
23145
+ this.set = [];
23146
+ this.pattern = pattern;
23147
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
23148
+ if (this.windowsPathsNoEscape) {
23149
+ this.pattern = this.pattern.replace(/\\/g, "/");
23150
+ }
23151
+ this.regexp = null;
23152
+ this.negate = false;
23153
+ this.comment = false;
23154
+ this.empty = false;
23155
+ this.partial = !!options.partial;
23156
+ this.make();
23157
+ }
23158
+ debug() {
23159
+ }
23160
+ make() {
23161
+ const pattern = this.pattern;
23162
+ const options = this.options;
23163
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23164
+ this.comment = true;
23165
+ return;
23166
+ }
23167
+ if (!pattern) {
23168
+ this.empty = true;
23169
+ return;
23170
+ }
23171
+ this.parseNegate();
23172
+ let set = this.globSet = this.braceExpand();
23173
+ if (options.debug)
23174
+ this.debug = (...args) => console.error(...args);
23175
+ this.debug(this.pattern, set);
23176
+ set = this.globParts = set.map((s) => s.split(slashSplit));
23177
+ this.debug(this.pattern, set);
23178
+ set = set.map((s, si, set2) => s.map(this.parse, this));
23179
+ this.debug(this.pattern, set);
23180
+ set = set.filter((s) => s.indexOf(false) === -1);
23181
+ this.debug(this.pattern, set);
23182
+ this.set = set;
23183
+ }
23184
+ parseNegate() {
23185
+ if (this.options.nonegate)
23186
+ return;
23187
+ const pattern = this.pattern;
23188
+ let negate = false;
23189
+ let negateOffset = 0;
23190
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
23191
+ negate = !negate;
23192
+ negateOffset++;
23193
+ }
23194
+ if (negateOffset)
23195
+ this.pattern = pattern.slice(negateOffset);
23196
+ this.negate = negate;
23197
+ }
23198
+ matchOne(file, pattern, partial) {
23199
+ var options = this.options;
23200
+ this.debug(
23201
+ "matchOne",
23202
+ { "this": this, file, pattern }
23203
+ );
23204
+ this.debug("matchOne", file.length, pattern.length);
23205
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
23206
+ this.debug("matchOne loop");
23207
+ var p = pattern[pi];
23208
+ var f = file[fi];
23209
+ this.debug(pattern, p, f);
23210
+ if (p === false)
23211
+ return false;
23212
+ if (p === GLOBSTAR) {
23213
+ this.debug("GLOBSTAR", [pattern, p, f]);
23214
+ var fr = fi;
23215
+ var pr = pi + 1;
23216
+ if (pr === pl) {
23217
+ this.debug("** at the end");
23218
+ for (; fi < fl; fi++) {
23219
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
23220
+ return false;
23221
+ }
23222
+ return true;
23223
+ }
23224
+ while (fr < fl) {
23225
+ var swallowee = file[fr];
23226
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
23227
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
23228
+ this.debug("globstar found match!", fr, fl, swallowee);
23229
+ return true;
23230
+ } else {
23231
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
23232
+ this.debug("dot detected!", file, fr, pattern, pr);
23233
+ break;
23234
+ }
23235
+ this.debug("globstar swallow a segment, and continue");
23236
+ fr++;
23237
+ }
23238
+ }
23239
+ if (partial) {
23240
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
23241
+ if (fr === fl)
23242
+ return true;
23243
+ }
23244
+ return false;
23245
+ }
23246
+ var hit;
23247
+ if (typeof p === "string") {
23248
+ hit = f === p;
23249
+ this.debug("string match", p, f, hit);
23250
+ } else {
23251
+ hit = f.match(p);
23252
+ this.debug("pattern match", p, f, hit);
23253
+ }
23254
+ if (!hit)
23255
+ return false;
23256
+ }
23257
+ if (fi === fl && pi === pl) {
23258
+ return true;
23259
+ } else if (fi === fl) {
23260
+ return partial;
23261
+ } else if (pi === pl) {
23262
+ return fi === fl - 1 && file[fi] === "";
23263
+ }
23264
+ throw new Error("wtf?");
23265
+ }
23266
+ braceExpand() {
23267
+ return braceExpand(this.pattern, this.options);
23268
+ }
23269
+ parse(pattern, isSub) {
23270
+ assertValidPattern(pattern);
23271
+ const options = this.options;
23272
+ if (pattern === "**") {
23273
+ if (!options.noglobstar)
23274
+ return GLOBSTAR;
23275
+ else
23276
+ pattern = "*";
23277
+ }
23278
+ if (pattern === "")
23279
+ return "";
23280
+ let re = "";
23281
+ let hasMagic = false;
23282
+ let escaping = false;
23283
+ const patternListStack = [];
23284
+ const negativeLists = [];
23285
+ let stateChar;
23286
+ let inClass = false;
23287
+ let reClassStart = -1;
23288
+ let classStart = -1;
23289
+ let cs;
23290
+ let pl;
23291
+ let sp;
23292
+ let dotTravAllowed = pattern.charAt(0) === ".";
23293
+ let dotFileAllowed = options.dot || dotTravAllowed;
23294
+ const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23295
+ const subPatternStart = (p) => p.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23296
+ const clearStateChar = () => {
23297
+ if (stateChar) {
23298
+ switch (stateChar) {
23299
+ case "*":
23300
+ re += star;
23301
+ hasMagic = true;
23302
+ break;
23303
+ case "?":
23304
+ re += qmark;
23305
+ hasMagic = true;
23306
+ break;
23307
+ default:
23308
+ re += "\\" + stateChar;
23309
+ break;
23310
+ }
23311
+ this.debug("clearStateChar %j %j", stateChar, re);
23312
+ stateChar = false;
23313
+ }
23314
+ };
23315
+ for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
23316
+ this.debug("%s %s %s %j", pattern, i, re, c);
23317
+ if (escaping) {
23318
+ if (c === "/") {
23319
+ return false;
23320
+ }
23321
+ if (reSpecials[c]) {
23322
+ re += "\\";
23323
+ }
23324
+ re += c;
23325
+ escaping = false;
23326
+ continue;
23327
+ }
23328
+ switch (c) {
23329
+ case "/": {
23330
+ return false;
23331
+ }
23332
+ case "\\":
23333
+ if (inClass && pattern.charAt(i + 1) === "-") {
23334
+ re += c;
23335
+ continue;
23336
+ }
23337
+ clearStateChar();
23338
+ escaping = true;
23339
+ continue;
23340
+ case "?":
23341
+ case "*":
23342
+ case "+":
23343
+ case "@":
23344
+ case "!":
23345
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
23346
+ if (inClass) {
23347
+ this.debug(" in class");
23348
+ if (c === "!" && i === classStart + 1)
23349
+ c = "^";
23350
+ re += c;
23351
+ continue;
23352
+ }
23353
+ this.debug("call clearStateChar %j", stateChar);
23354
+ clearStateChar();
23355
+ stateChar = c;
23356
+ if (options.noext)
23357
+ clearStateChar();
23358
+ continue;
23359
+ case "(": {
23360
+ if (inClass) {
23361
+ re += "(";
23362
+ continue;
23363
+ }
23364
+ if (!stateChar) {
23365
+ re += "\\(";
23366
+ continue;
23367
+ }
23368
+ const plEntry = {
23369
+ type: stateChar,
23370
+ start: i - 1,
23371
+ reStart: re.length,
23372
+ open: plTypes[stateChar].open,
23373
+ close: plTypes[stateChar].close
23374
+ };
23375
+ this.debug(this.pattern, " ", plEntry);
23376
+ patternListStack.push(plEntry);
23377
+ re += plEntry.open;
23378
+ if (plEntry.start === 0 && plEntry.type !== "!") {
23379
+ dotTravAllowed = true;
23380
+ re += subPatternStart(pattern.slice(i + 1));
23381
+ }
23382
+ this.debug("plType %j %j", stateChar, re);
23383
+ stateChar = false;
23384
+ continue;
23385
+ }
23386
+ case ")": {
23387
+ const plEntry = patternListStack[patternListStack.length - 1];
23388
+ if (inClass || !plEntry) {
23389
+ re += "\\)";
23390
+ continue;
23391
+ }
23392
+ patternListStack.pop();
23393
+ clearStateChar();
23394
+ hasMagic = true;
23395
+ pl = plEntry;
23396
+ re += pl.close;
23397
+ if (pl.type === "!") {
23398
+ negativeLists.push(Object.assign(pl, { reEnd: re.length }));
23399
+ }
23400
+ continue;
23401
+ }
23402
+ case "|": {
23403
+ const plEntry = patternListStack[patternListStack.length - 1];
23404
+ if (inClass || !plEntry) {
23405
+ re += "\\|";
23406
+ continue;
23407
+ }
23408
+ clearStateChar();
23409
+ re += "|";
23410
+ if (plEntry.start === 0 && plEntry.type !== "!") {
23411
+ dotTravAllowed = true;
23412
+ re += subPatternStart(pattern.slice(i + 1));
23413
+ }
23414
+ continue;
23415
+ }
23416
+ case "[":
23417
+ clearStateChar();
23418
+ if (inClass) {
23419
+ re += "\\" + c;
23420
+ continue;
23421
+ }
23422
+ inClass = true;
23423
+ classStart = i;
23424
+ reClassStart = re.length;
23425
+ re += c;
23426
+ continue;
23427
+ case "]":
23428
+ if (i === classStart + 1 || !inClass) {
23429
+ re += "\\" + c;
23430
+ continue;
23431
+ }
23432
+ cs = pattern.substring(classStart + 1, i);
23433
+ try {
23434
+ RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
23435
+ re += c;
23436
+ } catch (er) {
23437
+ re = re.substring(0, reClassStart) + "(?:$.)";
23438
+ }
23439
+ hasMagic = true;
23440
+ inClass = false;
23441
+ continue;
23442
+ default:
23443
+ clearStateChar();
23444
+ if (reSpecials[c] && !(c === "^" && inClass)) {
23445
+ re += "\\";
23446
+ }
23447
+ re += c;
23448
+ break;
23449
+ }
23450
+ }
23451
+ if (inClass) {
23452
+ cs = pattern.slice(classStart + 1);
23453
+ sp = this.parse(cs, SUBPARSE);
23454
+ re = re.substring(0, reClassStart) + "\\[" + sp[0];
23455
+ hasMagic = hasMagic || sp[1];
23456
+ }
23457
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
23458
+ let tail;
23459
+ tail = re.slice(pl.reStart + pl.open.length);
23460
+ this.debug("setting tail", re, pl);
23461
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
23462
+ if (!$2) {
23463
+ $2 = "\\";
23464
+ }
23465
+ return $1 + $1 + $2 + "|";
23466
+ });
23467
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
23468
+ const t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
23469
+ hasMagic = true;
23470
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
23471
+ }
23472
+ clearStateChar();
23473
+ if (escaping) {
23474
+ re += "\\\\";
23475
+ }
23476
+ const addPatternStart = addPatternStartSet[re.charAt(0)];
23477
+ for (let n = negativeLists.length - 1; n > -1; n--) {
23478
+ const nl = negativeLists[n];
23479
+ const nlBefore = re.slice(0, nl.reStart);
23480
+ const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
23481
+ let nlAfter = re.slice(nl.reEnd);
23482
+ const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
23483
+ const closeParensBefore = nlBefore.split(")").length;
23484
+ const openParensBefore = nlBefore.split("(").length - closeParensBefore;
23485
+ let cleanAfter = nlAfter;
23486
+ for (let i = 0; i < openParensBefore; i++) {
23487
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
23488
+ }
23489
+ nlAfter = cleanAfter;
23490
+ const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
23491
+ re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
23492
+ }
23493
+ if (re !== "" && hasMagic) {
23494
+ re = "(?=.)" + re;
23495
+ }
23496
+ if (addPatternStart) {
23497
+ re = patternStart() + re;
23498
+ }
23499
+ if (isSub === SUBPARSE) {
23500
+ return [re, hasMagic];
23501
+ }
23502
+ if (options.nocase && !hasMagic) {
23503
+ hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
23504
+ }
23505
+ if (!hasMagic) {
23506
+ return globUnescape(pattern);
23507
+ }
23508
+ const flags = options.nocase ? "i" : "";
23509
+ try {
23510
+ return Object.assign(new RegExp("^" + re + "$", flags), {
23511
+ _glob: pattern,
23512
+ _src: re
23513
+ });
23514
+ } catch (er) {
23515
+ return new RegExp("$.");
23516
+ }
23517
+ }
23518
+ makeRe() {
23519
+ if (this.regexp || this.regexp === false)
23520
+ return this.regexp;
23521
+ const set = this.set;
23522
+ if (!set.length) {
23523
+ this.regexp = false;
23524
+ return this.regexp;
23525
+ }
23526
+ const options = this.options;
23527
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
23528
+ const flags = options.nocase ? "i" : "";
23529
+ let re = set.map((pattern) => {
23530
+ pattern = pattern.map(
23531
+ (p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src
23532
+ ).reduce((set2, p) => {
23533
+ if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
23534
+ set2.push(p);
23535
+ }
23536
+ return set2;
23537
+ }, []);
23538
+ pattern.forEach((p, i) => {
23539
+ if (p !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) {
23540
+ return;
23541
+ }
23542
+ if (i === 0) {
23543
+ if (pattern.length > 1) {
23544
+ pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
23545
+ } else {
23546
+ pattern[i] = twoStar;
23547
+ }
23548
+ } else if (i === pattern.length - 1) {
23549
+ pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
23550
+ } else {
23551
+ pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
23552
+ pattern[i + 1] = GLOBSTAR;
23553
+ }
23554
+ });
23555
+ return pattern.filter((p) => p !== GLOBSTAR).join("/");
23556
+ }).join("|");
23557
+ re = "^(?:" + re + ")$";
23558
+ if (this.negate)
23559
+ re = "^(?!" + re + ").*$";
23560
+ try {
23561
+ this.regexp = new RegExp(re, flags);
23562
+ } catch (ex) {
23563
+ this.regexp = false;
23564
+ }
23565
+ return this.regexp;
23566
+ }
23567
+ match(f, partial = this.partial) {
23568
+ this.debug("match", f, this.pattern);
23569
+ if (this.comment)
23570
+ return false;
23571
+ if (this.empty)
23572
+ return f === "";
23573
+ if (f === "/" && partial)
23574
+ return true;
23575
+ const options = this.options;
23576
+ if (path4.sep !== "/") {
23577
+ f = f.split(path4.sep).join("/");
23578
+ }
23579
+ f = f.split(slashSplit);
23580
+ this.debug(this.pattern, "split", f);
23581
+ const set = this.set;
23582
+ this.debug(this.pattern, "set", set);
23583
+ let filename;
23584
+ for (let i = f.length - 1; i >= 0; i--) {
23585
+ filename = f[i];
23586
+ if (filename)
23587
+ break;
23588
+ }
23589
+ for (let i = 0; i < set.length; i++) {
23590
+ const pattern = set[i];
23591
+ let file = f;
23592
+ if (options.matchBase && pattern.length === 1) {
23593
+ file = [filename];
23594
+ }
23595
+ const hit = this.matchOne(file, pattern, partial);
23596
+ if (hit) {
23597
+ if (options.flipNegate)
23598
+ return true;
23599
+ return !this.negate;
23600
+ }
23601
+ }
23602
+ if (options.flipNegate)
23603
+ return false;
23604
+ return this.negate;
23605
+ }
23606
+ static defaults(def) {
23607
+ return minimatch.defaults(def).Minimatch;
23608
+ }
23609
+ };
23610
+ minimatch.Minimatch = Minimatch;
23611
+ }
23612
+ });
23613
+
23614
+ // node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
23615
+ var require_inherits_browser = __commonJS({
23616
+ "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module2) {
23617
+ if (typeof Object.create === "function") {
23618
+ module2.exports = function inherits(ctor, superCtor) {
23619
+ if (superCtor) {
23620
+ ctor.super_ = superCtor;
23621
+ ctor.prototype = Object.create(superCtor.prototype, {
23622
+ constructor: {
23623
+ value: ctor,
23624
+ enumerable: false,
23625
+ writable: true,
23626
+ configurable: true
23627
+ }
23628
+ });
23629
+ }
23630
+ };
23631
+ } else {
23632
+ module2.exports = function inherits(ctor, superCtor) {
23633
+ if (superCtor) {
23634
+ ctor.super_ = superCtor;
23635
+ var TempCtor = function() {
23636
+ };
23637
+ TempCtor.prototype = superCtor.prototype;
23638
+ ctor.prototype = new TempCtor();
23639
+ ctor.prototype.constructor = ctor;
23640
+ }
23641
+ };
23642
+ }
23643
+ }
23644
+ });
23645
+
23646
+ // node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
23647
+ var require_inherits = __commonJS({
23648
+ "node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js"(exports, module2) {
23649
+ try {
23650
+ util2 = require("util");
23651
+ if (typeof util2.inherits !== "function")
23652
+ throw "";
23653
+ module2.exports = util2.inherits;
23654
+ } catch (e) {
23655
+ module2.exports = require_inherits_browser();
23656
+ }
23657
+ var util2;
23658
+ }
23659
+ });
23660
+
23661
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/common.js
23662
+ var require_common2 = __commonJS({
23663
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/common.js"(exports) {
23664
+ exports.setopts = setopts;
23665
+ exports.ownProp = ownProp;
23666
+ exports.makeAbs = makeAbs;
23667
+ exports.finish = finish;
23668
+ exports.mark = mark;
23669
+ exports.isIgnored = isIgnored;
23670
+ exports.childrenIgnored = childrenIgnored;
23671
+ function ownProp(obj, field) {
23672
+ return Object.prototype.hasOwnProperty.call(obj, field);
23673
+ }
23674
+ var fs7 = require("fs");
23675
+ var path4 = require("path");
23676
+ var minimatch = require_minimatch();
23677
+ var isAbsolute = require("path").isAbsolute;
23678
+ var Minimatch = minimatch.Minimatch;
23679
+ function alphasort(a, b) {
23680
+ return a.localeCompare(b, "en");
23681
+ }
23682
+ function setupIgnores(self2, options) {
23683
+ self2.ignore = options.ignore || [];
23684
+ if (!Array.isArray(self2.ignore))
23685
+ self2.ignore = [self2.ignore];
23686
+ if (self2.ignore.length) {
23687
+ self2.ignore = self2.ignore.map(ignoreMap);
23688
+ }
23689
+ }
23690
+ function ignoreMap(pattern) {
23691
+ var gmatcher = null;
23692
+ if (pattern.slice(-3) === "/**") {
23693
+ var gpattern = pattern.replace(/(\/\*\*)+$/, "");
23694
+ gmatcher = new Minimatch(gpattern, { dot: true });
23695
+ }
23696
+ return {
23697
+ matcher: new Minimatch(pattern, { dot: true }),
23698
+ gmatcher
23699
+ };
23700
+ }
23701
+ function setopts(self2, pattern, options) {
23702
+ if (!options)
23703
+ options = {};
23704
+ if (options.matchBase && -1 === pattern.indexOf("/")) {
23705
+ if (options.noglobstar) {
23706
+ throw new Error("base matching requires globstar");
23707
+ }
23708
+ pattern = "**/" + pattern;
23709
+ }
23710
+ self2.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
23711
+ if (self2.windowsPathsNoEscape) {
23712
+ pattern = pattern.replace(/\\/g, "/");
23713
+ }
23714
+ self2.silent = !!options.silent;
23715
+ self2.pattern = pattern;
23716
+ self2.strict = options.strict !== false;
23717
+ self2.realpath = !!options.realpath;
23718
+ self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
23719
+ self2.follow = !!options.follow;
23720
+ self2.dot = !!options.dot;
23721
+ self2.mark = !!options.mark;
23722
+ self2.nodir = !!options.nodir;
23723
+ if (self2.nodir)
23724
+ self2.mark = true;
23725
+ self2.sync = !!options.sync;
23726
+ self2.nounique = !!options.nounique;
23727
+ self2.nonull = !!options.nonull;
23728
+ self2.nosort = !!options.nosort;
23729
+ self2.nocase = !!options.nocase;
23730
+ self2.stat = !!options.stat;
23731
+ self2.noprocess = !!options.noprocess;
23732
+ self2.absolute = !!options.absolute;
23733
+ self2.fs = options.fs || fs7;
23734
+ self2.maxLength = options.maxLength || Infinity;
23735
+ self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
23736
+ self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
23737
+ self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
23738
+ setupIgnores(self2, options);
23739
+ self2.changedCwd = false;
23740
+ var cwd = process.cwd();
23741
+ if (!ownProp(options, "cwd"))
23742
+ self2.cwd = path4.resolve(cwd);
23743
+ else {
23744
+ self2.cwd = path4.resolve(options.cwd);
23745
+ self2.changedCwd = self2.cwd !== cwd;
23746
+ }
23747
+ self2.root = options.root || path4.resolve(self2.cwd, "/");
23748
+ self2.root = path4.resolve(self2.root);
23749
+ self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
23750
+ self2.nomount = !!options.nomount;
23751
+ if (process.platform === "win32") {
23752
+ self2.root = self2.root.replace(/\\/g, "/");
23753
+ self2.cwd = self2.cwd.replace(/\\/g, "/");
23754
+ self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
23755
+ }
23756
+ options.nonegate = true;
23757
+ options.nocomment = true;
23758
+ self2.minimatch = new Minimatch(pattern, options);
23759
+ self2.options = self2.minimatch.options;
23760
+ }
23761
+ function finish(self2) {
23762
+ var nou = self2.nounique;
23763
+ var all = nou ? [] : /* @__PURE__ */ Object.create(null);
23764
+ for (var i = 0, l = self2.matches.length; i < l; i++) {
23765
+ var matches = self2.matches[i];
23766
+ if (!matches || Object.keys(matches).length === 0) {
23767
+ if (self2.nonull) {
23768
+ var literal = self2.minimatch.globSet[i];
23769
+ if (nou)
23770
+ all.push(literal);
23771
+ else
23772
+ all[literal] = true;
23773
+ }
23774
+ } else {
23775
+ var m = Object.keys(matches);
23776
+ if (nou)
23777
+ all.push.apply(all, m);
23778
+ else
23779
+ m.forEach(function(m2) {
23780
+ all[m2] = true;
23781
+ });
23782
+ }
23783
+ }
23784
+ if (!nou)
23785
+ all = Object.keys(all);
23786
+ if (!self2.nosort)
23787
+ all = all.sort(alphasort);
23788
+ if (self2.mark) {
23789
+ for (var i = 0; i < all.length; i++) {
23790
+ all[i] = self2._mark(all[i]);
23791
+ }
23792
+ if (self2.nodir) {
23793
+ all = all.filter(function(e) {
23794
+ var notDir = !/\/$/.test(e);
23795
+ var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
23796
+ if (notDir && c)
23797
+ notDir = c !== "DIR" && !Array.isArray(c);
23798
+ return notDir;
23799
+ });
23800
+ }
23801
+ }
23802
+ if (self2.ignore.length)
23803
+ all = all.filter(function(m2) {
23804
+ return !isIgnored(self2, m2);
23805
+ });
23806
+ self2.found = all;
23807
+ }
23808
+ function mark(self2, p) {
23809
+ var abs = makeAbs(self2, p);
23810
+ var c = self2.cache[abs];
23811
+ var m = p;
23812
+ if (c) {
23813
+ var isDir = c === "DIR" || Array.isArray(c);
23814
+ var slash = p.slice(-1) === "/";
23815
+ if (isDir && !slash)
23816
+ m += "/";
23817
+ else if (!isDir && slash)
23818
+ m = m.slice(0, -1);
23819
+ if (m !== p) {
23820
+ var mabs = makeAbs(self2, m);
23821
+ self2.statCache[mabs] = self2.statCache[abs];
23822
+ self2.cache[mabs] = self2.cache[abs];
23823
+ }
23824
+ }
23825
+ return m;
23826
+ }
23827
+ function makeAbs(self2, f) {
23828
+ var abs = f;
23829
+ if (f.charAt(0) === "/") {
23830
+ abs = path4.join(self2.root, f);
23831
+ } else if (isAbsolute(f) || f === "") {
23832
+ abs = f;
23833
+ } else if (self2.changedCwd) {
23834
+ abs = path4.resolve(self2.cwd, f);
23835
+ } else {
23836
+ abs = path4.resolve(f);
23837
+ }
23838
+ if (process.platform === "win32")
23839
+ abs = abs.replace(/\\/g, "/");
23840
+ return abs;
23841
+ }
23842
+ function isIgnored(self2, path5) {
23843
+ if (!self2.ignore.length)
23844
+ return false;
23845
+ return self2.ignore.some(function(item) {
23846
+ return item.matcher.match(path5) || !!(item.gmatcher && item.gmatcher.match(path5));
23847
+ });
23848
+ }
23849
+ function childrenIgnored(self2, path5) {
23850
+ if (!self2.ignore.length)
23851
+ return false;
23852
+ return self2.ignore.some(function(item) {
23853
+ return !!(item.gmatcher && item.gmatcher.match(path5));
23854
+ });
23855
+ }
23856
+ }
23857
+ });
23858
+
23859
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/sync.js
23860
+ var require_sync = __commonJS({
23861
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/sync.js"(exports, module2) {
23862
+ module2.exports = globSync;
23863
+ globSync.GlobSync = GlobSync;
23864
+ var rp = require_fs();
23865
+ var minimatch = require_minimatch();
23866
+ var Minimatch = minimatch.Minimatch;
23867
+ var Glob = require_glob().Glob;
23868
+ var util2 = require("util");
23869
+ var path4 = require("path");
23870
+ var assert = require("assert");
23871
+ var isAbsolute = require("path").isAbsolute;
23872
+ var common = require_common2();
23873
+ var setopts = common.setopts;
23874
+ var ownProp = common.ownProp;
23875
+ var childrenIgnored = common.childrenIgnored;
23876
+ var isIgnored = common.isIgnored;
23877
+ function globSync(pattern, options) {
23878
+ if (typeof options === "function" || arguments.length === 3)
23879
+ throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
23880
+ return new GlobSync(pattern, options).found;
23881
+ }
23882
+ function GlobSync(pattern, options) {
23883
+ if (!pattern)
23884
+ throw new Error("must provide pattern");
23885
+ if (typeof options === "function" || arguments.length === 3)
23886
+ throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
23887
+ if (!(this instanceof GlobSync))
23888
+ return new GlobSync(pattern, options);
23889
+ setopts(this, pattern, options);
23890
+ if (this.noprocess)
23891
+ return this;
23892
+ var n = this.minimatch.set.length;
23893
+ this.matches = new Array(n);
23894
+ for (var i = 0; i < n; i++) {
23895
+ this._process(this.minimatch.set[i], i, false);
23896
+ }
23897
+ this._finish();
23898
+ }
23899
+ GlobSync.prototype._finish = function() {
23900
+ assert.ok(this instanceof GlobSync);
23901
+ if (this.realpath) {
23902
+ var self2 = this;
23903
+ this.matches.forEach(function(matchset, index4) {
23904
+ var set = self2.matches[index4] = /* @__PURE__ */ Object.create(null);
23905
+ for (var p in matchset) {
23906
+ try {
23907
+ p = self2._makeAbs(p);
23908
+ var real = rp.realpathSync(p, self2.realpathCache);
23909
+ set[real] = true;
23910
+ } catch (er) {
23911
+ if (er.syscall === "stat")
23912
+ set[self2._makeAbs(p)] = true;
23913
+ else
23914
+ throw er;
23915
+ }
23916
+ }
23917
+ });
23918
+ }
23919
+ common.finish(this);
23920
+ };
23921
+ GlobSync.prototype._process = function(pattern, index4, inGlobStar) {
23922
+ assert.ok(this instanceof GlobSync);
23923
+ var n = 0;
23924
+ while (typeof pattern[n] === "string") {
23925
+ n++;
23926
+ }
23927
+ var prefix;
23928
+ switch (n) {
23929
+ case pattern.length:
23930
+ this._processSimple(pattern.join("/"), index4);
23931
+ return;
23932
+ case 0:
23933
+ prefix = null;
23934
+ break;
23935
+ default:
23936
+ prefix = pattern.slice(0, n).join("/");
23937
+ break;
23938
+ }
23939
+ var remain = pattern.slice(n);
23940
+ var read;
23941
+ if (prefix === null)
23942
+ read = ".";
23943
+ else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
23944
+ return typeof p === "string" ? p : "[*]";
23945
+ }).join("/"))) {
23946
+ if (!prefix || !isAbsolute(prefix))
23947
+ prefix = "/" + prefix;
23948
+ read = prefix;
23949
+ } else
23950
+ read = prefix;
23951
+ var abs = this._makeAbs(read);
23952
+ if (childrenIgnored(this, read))
23953
+ return;
23954
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
23955
+ if (isGlobStar)
23956
+ this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar);
23957
+ else
23958
+ this._processReaddir(prefix, read, abs, remain, index4, inGlobStar);
23959
+ };
23960
+ GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar) {
23961
+ var entries = this._readdir(abs, inGlobStar);
23962
+ if (!entries)
23963
+ return;
23964
+ var pn = remain[0];
23965
+ var negate = !!this.minimatch.negate;
23966
+ var rawGlob = pn._glob;
23967
+ var dotOk = this.dot || rawGlob.charAt(0) === ".";
23968
+ var matchedEntries = [];
23969
+ for (var i = 0; i < entries.length; i++) {
23970
+ var e = entries[i];
23971
+ if (e.charAt(0) !== "." || dotOk) {
23972
+ var m;
23973
+ if (negate && !prefix) {
23974
+ m = !e.match(pn);
23975
+ } else {
23976
+ m = e.match(pn);
23977
+ }
23978
+ if (m)
23979
+ matchedEntries.push(e);
23980
+ }
23981
+ }
23982
+ var len = matchedEntries.length;
23983
+ if (len === 0)
23984
+ return;
23985
+ if (remain.length === 1 && !this.mark && !this.stat) {
23986
+ if (!this.matches[index4])
23987
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
23988
+ for (var i = 0; i < len; i++) {
23989
+ var e = matchedEntries[i];
23990
+ if (prefix) {
23991
+ if (prefix.slice(-1) !== "/")
23992
+ e = prefix + "/" + e;
23993
+ else
23994
+ e = prefix + e;
23995
+ }
23996
+ if (e.charAt(0) === "/" && !this.nomount) {
23997
+ e = path4.join(this.root, e);
23998
+ }
23999
+ this._emitMatch(index4, e);
24000
+ }
24001
+ return;
24002
+ }
24003
+ remain.shift();
24004
+ for (var i = 0; i < len; i++) {
24005
+ var e = matchedEntries[i];
24006
+ var newPattern;
24007
+ if (prefix)
24008
+ newPattern = [prefix, e];
24009
+ else
24010
+ newPattern = [e];
24011
+ this._process(newPattern.concat(remain), index4, inGlobStar);
24012
+ }
24013
+ };
24014
+ GlobSync.prototype._emitMatch = function(index4, e) {
24015
+ if (isIgnored(this, e))
24016
+ return;
24017
+ var abs = this._makeAbs(e);
24018
+ if (this.mark)
24019
+ e = this._mark(e);
24020
+ if (this.absolute) {
24021
+ e = abs;
24022
+ }
24023
+ if (this.matches[index4][e])
24024
+ return;
24025
+ if (this.nodir) {
24026
+ var c = this.cache[abs];
24027
+ if (c === "DIR" || Array.isArray(c))
24028
+ return;
24029
+ }
24030
+ this.matches[index4][e] = true;
24031
+ if (this.stat)
24032
+ this._stat(e);
24033
+ };
24034
+ GlobSync.prototype._readdirInGlobStar = function(abs) {
24035
+ if (this.follow)
24036
+ return this._readdir(abs, false);
24037
+ var entries;
24038
+ var lstat;
24039
+ var stat;
24040
+ try {
24041
+ lstat = this.fs.lstatSync(abs);
24042
+ } catch (er) {
24043
+ if (er.code === "ENOENT") {
24044
+ return null;
24045
+ }
24046
+ }
24047
+ var isSym = lstat && lstat.isSymbolicLink();
24048
+ this.symlinks[abs] = isSym;
24049
+ if (!isSym && lstat && !lstat.isDirectory())
24050
+ this.cache[abs] = "FILE";
24051
+ else
24052
+ entries = this._readdir(abs, false);
24053
+ return entries;
24054
+ };
24055
+ GlobSync.prototype._readdir = function(abs, inGlobStar) {
24056
+ var entries;
24057
+ if (inGlobStar && !ownProp(this.symlinks, abs))
24058
+ return this._readdirInGlobStar(abs);
24059
+ if (ownProp(this.cache, abs)) {
24060
+ var c = this.cache[abs];
24061
+ if (!c || c === "FILE")
24062
+ return null;
24063
+ if (Array.isArray(c))
24064
+ return c;
24065
+ }
24066
+ try {
24067
+ return this._readdirEntries(abs, this.fs.readdirSync(abs));
24068
+ } catch (er) {
24069
+ this._readdirError(abs, er);
24070
+ return null;
24071
+ }
24072
+ };
24073
+ GlobSync.prototype._readdirEntries = function(abs, entries) {
24074
+ if (!this.mark && !this.stat) {
24075
+ for (var i = 0; i < entries.length; i++) {
24076
+ var e = entries[i];
24077
+ if (abs === "/")
24078
+ e = abs + e;
24079
+ else
24080
+ e = abs + "/" + e;
24081
+ this.cache[e] = true;
24082
+ }
24083
+ }
24084
+ this.cache[abs] = entries;
24085
+ return entries;
24086
+ };
24087
+ GlobSync.prototype._readdirError = function(f, er) {
24088
+ switch (er.code) {
24089
+ case "ENOTSUP":
24090
+ case "ENOTDIR":
24091
+ var abs = this._makeAbs(f);
24092
+ this.cache[abs] = "FILE";
24093
+ if (abs === this.cwdAbs) {
24094
+ var error2 = new Error(er.code + " invalid cwd " + this.cwd);
24095
+ error2.path = this.cwd;
24096
+ error2.code = er.code;
24097
+ throw error2;
24098
+ }
24099
+ break;
24100
+ case "ENOENT":
24101
+ case "ELOOP":
24102
+ case "ENAMETOOLONG":
24103
+ case "UNKNOWN":
24104
+ this.cache[this._makeAbs(f)] = false;
24105
+ break;
24106
+ default:
24107
+ this.cache[this._makeAbs(f)] = false;
24108
+ if (this.strict)
24109
+ throw er;
24110
+ if (!this.silent)
24111
+ console.error("glob error", er);
24112
+ break;
24113
+ }
24114
+ };
24115
+ GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar) {
24116
+ var entries = this._readdir(abs, inGlobStar);
24117
+ if (!entries)
24118
+ return;
24119
+ var remainWithoutGlobStar = remain.slice(1);
24120
+ var gspref = prefix ? [prefix] : [];
24121
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
24122
+ this._process(noGlobStar, index4, false);
24123
+ var len = entries.length;
24124
+ var isSym = this.symlinks[abs];
24125
+ if (isSym && inGlobStar)
24126
+ return;
24127
+ for (var i = 0; i < len; i++) {
24128
+ var e = entries[i];
24129
+ if (e.charAt(0) === "." && !this.dot)
24130
+ continue;
24131
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
24132
+ this._process(instead, index4, true);
24133
+ var below = gspref.concat(entries[i], remain);
24134
+ this._process(below, index4, true);
24135
+ }
24136
+ };
24137
+ GlobSync.prototype._processSimple = function(prefix, index4) {
24138
+ var exists = this._stat(prefix);
24139
+ if (!this.matches[index4])
24140
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24141
+ if (!exists)
24142
+ return;
24143
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
24144
+ var trail = /[\/\\]$/.test(prefix);
24145
+ if (prefix.charAt(0) === "/") {
24146
+ prefix = path4.join(this.root, prefix);
24147
+ } else {
24148
+ prefix = path4.resolve(this.root, prefix);
24149
+ if (trail)
24150
+ prefix += "/";
24151
+ }
24152
+ }
24153
+ if (process.platform === "win32")
24154
+ prefix = prefix.replace(/\\/g, "/");
24155
+ this._emitMatch(index4, prefix);
24156
+ };
24157
+ GlobSync.prototype._stat = function(f) {
24158
+ var abs = this._makeAbs(f);
24159
+ var needDir = f.slice(-1) === "/";
24160
+ if (f.length > this.maxLength)
24161
+ return false;
24162
+ if (!this.stat && ownProp(this.cache, abs)) {
24163
+ var c = this.cache[abs];
24164
+ if (Array.isArray(c))
24165
+ c = "DIR";
24166
+ if (!needDir || c === "DIR")
24167
+ return c;
24168
+ if (needDir && c === "FILE")
24169
+ return false;
24170
+ }
24171
+ var exists;
24172
+ var stat = this.statCache[abs];
24173
+ if (!stat) {
24174
+ var lstat;
24175
+ try {
24176
+ lstat = this.fs.lstatSync(abs);
24177
+ } catch (er) {
24178
+ if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
24179
+ this.statCache[abs] = false;
24180
+ return false;
24181
+ }
24182
+ }
24183
+ if (lstat && lstat.isSymbolicLink()) {
24184
+ try {
24185
+ stat = this.fs.statSync(abs);
24186
+ } catch (er) {
24187
+ stat = lstat;
24188
+ }
24189
+ } else {
24190
+ stat = lstat;
24191
+ }
24192
+ }
24193
+ this.statCache[abs] = stat;
24194
+ var c = true;
24195
+ if (stat)
24196
+ c = stat.isDirectory() ? "DIR" : "FILE";
24197
+ this.cache[abs] = this.cache[abs] || c;
24198
+ if (needDir && c === "FILE")
24199
+ return false;
24200
+ return c;
24201
+ };
24202
+ GlobSync.prototype._mark = function(p) {
24203
+ return common.mark(this, p);
24204
+ };
24205
+ GlobSync.prototype._makeAbs = function(f) {
24206
+ return common.makeAbs(this, f);
24207
+ };
24208
+ }
24209
+ });
24210
+
24211
+ // node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
24212
+ var require_wrappy = __commonJS({
24213
+ "node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js"(exports, module2) {
24214
+ module2.exports = wrappy;
24215
+ function wrappy(fn, cb) {
24216
+ if (fn && cb)
24217
+ return wrappy(fn)(cb);
24218
+ if (typeof fn !== "function")
24219
+ throw new TypeError("need wrapper function");
24220
+ Object.keys(fn).forEach(function(k) {
24221
+ wrapper[k] = fn[k];
24222
+ });
24223
+ return wrapper;
24224
+ function wrapper() {
24225
+ var args = new Array(arguments.length);
24226
+ for (var i = 0; i < args.length; i++) {
24227
+ args[i] = arguments[i];
24228
+ }
24229
+ var ret = fn.apply(this, args);
24230
+ var cb2 = args[args.length - 1];
24231
+ if (typeof ret === "function" && ret !== cb2) {
24232
+ Object.keys(cb2).forEach(function(k) {
24233
+ ret[k] = cb2[k];
24234
+ });
24235
+ }
24236
+ return ret;
24237
+ }
24238
+ }
24239
+ }
24240
+ });
24241
+
24242
+ // node_modules/.pnpm/once@1.4.0/node_modules/once/once.js
24243
+ var require_once = __commonJS({
24244
+ "node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports, module2) {
24245
+ var wrappy = require_wrappy();
24246
+ module2.exports = wrappy(once);
24247
+ module2.exports.strict = wrappy(onceStrict);
24248
+ once.proto = once(function() {
24249
+ Object.defineProperty(Function.prototype, "once", {
24250
+ value: function() {
24251
+ return once(this);
24252
+ },
24253
+ configurable: true
24254
+ });
24255
+ Object.defineProperty(Function.prototype, "onceStrict", {
24256
+ value: function() {
24257
+ return onceStrict(this);
24258
+ },
24259
+ configurable: true
24260
+ });
24261
+ });
24262
+ function once(fn) {
24263
+ var f = function() {
24264
+ if (f.called)
24265
+ return f.value;
24266
+ f.called = true;
24267
+ return f.value = fn.apply(this, arguments);
24268
+ };
24269
+ f.called = false;
24270
+ return f;
24271
+ }
24272
+ function onceStrict(fn) {
24273
+ var f = function() {
24274
+ if (f.called)
24275
+ throw new Error(f.onceError);
24276
+ f.called = true;
24277
+ return f.value = fn.apply(this, arguments);
24278
+ };
24279
+ var name = fn.name || "Function wrapped with `once`";
24280
+ f.onceError = name + " shouldn't be called more than once";
24281
+ f.called = false;
24282
+ return f;
24283
+ }
24284
+ }
24285
+ });
24286
+
24287
+ // node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js
24288
+ var require_inflight = __commonJS({
24289
+ "node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js"(exports, module2) {
24290
+ var wrappy = require_wrappy();
24291
+ var reqs = /* @__PURE__ */ Object.create(null);
24292
+ var once = require_once();
24293
+ module2.exports = wrappy(inflight);
24294
+ function inflight(key, cb) {
24295
+ if (reqs[key]) {
24296
+ reqs[key].push(cb);
24297
+ return null;
24298
+ } else {
24299
+ reqs[key] = [cb];
24300
+ return makeres(key);
24301
+ }
24302
+ }
24303
+ function makeres(key) {
24304
+ return once(function RES() {
24305
+ var cbs = reqs[key];
24306
+ var len = cbs.length;
24307
+ var args = slice(arguments);
24308
+ try {
24309
+ for (var i = 0; i < len; i++) {
24310
+ cbs[i].apply(null, args);
24311
+ }
24312
+ } finally {
24313
+ if (cbs.length > len) {
24314
+ cbs.splice(0, len);
24315
+ process.nextTick(function() {
24316
+ RES.apply(null, args);
24317
+ });
24318
+ } else {
24319
+ delete reqs[key];
24320
+ }
24321
+ }
24322
+ });
24323
+ }
24324
+ function slice(args) {
24325
+ var length = args.length;
24326
+ var array = [];
24327
+ for (var i = 0; i < length; i++)
24328
+ array[i] = args[i];
24329
+ return array;
24330
+ }
24331
+ }
24332
+ });
24333
+
24334
+ // node_modules/.pnpm/glob@8.1.0/node_modules/glob/glob.js
24335
+ var require_glob = __commonJS({
24336
+ "node_modules/.pnpm/glob@8.1.0/node_modules/glob/glob.js"(exports, module2) {
24337
+ module2.exports = glob2;
24338
+ var rp = require_fs();
24339
+ var minimatch = require_minimatch();
24340
+ var Minimatch = minimatch.Minimatch;
24341
+ var inherits = require_inherits();
24342
+ var EE = require("events").EventEmitter;
24343
+ var path4 = require("path");
24344
+ var assert = require("assert");
24345
+ var isAbsolute = require("path").isAbsolute;
24346
+ var globSync = require_sync();
24347
+ var common = require_common2();
24348
+ var setopts = common.setopts;
24349
+ var ownProp = common.ownProp;
24350
+ var inflight = require_inflight();
24351
+ var util2 = require("util");
24352
+ var childrenIgnored = common.childrenIgnored;
24353
+ var isIgnored = common.isIgnored;
24354
+ var once = require_once();
24355
+ function glob2(pattern, options, cb) {
24356
+ if (typeof options === "function")
24357
+ cb = options, options = {};
24358
+ if (!options)
24359
+ options = {};
24360
+ if (options.sync) {
24361
+ if (cb)
24362
+ throw new TypeError("callback provided to sync glob");
24363
+ return globSync(pattern, options);
24364
+ }
24365
+ return new Glob(pattern, options, cb);
24366
+ }
24367
+ glob2.sync = globSync;
24368
+ var GlobSync = glob2.GlobSync = globSync.GlobSync;
24369
+ glob2.glob = glob2;
24370
+ function extend(origin, add) {
24371
+ if (add === null || typeof add !== "object") {
24372
+ return origin;
24373
+ }
24374
+ var keys = Object.keys(add);
24375
+ var i = keys.length;
24376
+ while (i--) {
24377
+ origin[keys[i]] = add[keys[i]];
24378
+ }
24379
+ return origin;
24380
+ }
24381
+ glob2.hasMagic = function(pattern, options_) {
24382
+ var options = extend({}, options_);
24383
+ options.noprocess = true;
24384
+ var g = new Glob(pattern, options);
24385
+ var set = g.minimatch.set;
24386
+ if (!pattern)
24387
+ return false;
24388
+ if (set.length > 1)
24389
+ return true;
24390
+ for (var j = 0; j < set[0].length; j++) {
24391
+ if (typeof set[0][j] !== "string")
24392
+ return true;
24393
+ }
24394
+ return false;
24395
+ };
24396
+ glob2.Glob = Glob;
24397
+ inherits(Glob, EE);
24398
+ function Glob(pattern, options, cb) {
24399
+ if (typeof options === "function") {
24400
+ cb = options;
24401
+ options = null;
24402
+ }
24403
+ if (options && options.sync) {
24404
+ if (cb)
24405
+ throw new TypeError("callback provided to sync glob");
24406
+ return new GlobSync(pattern, options);
24407
+ }
24408
+ if (!(this instanceof Glob))
24409
+ return new Glob(pattern, options, cb);
24410
+ setopts(this, pattern, options);
24411
+ this._didRealPath = false;
24412
+ var n = this.minimatch.set.length;
24413
+ this.matches = new Array(n);
24414
+ if (typeof cb === "function") {
24415
+ cb = once(cb);
24416
+ this.on("error", cb);
24417
+ this.on("end", function(matches) {
24418
+ cb(null, matches);
24419
+ });
24420
+ }
24421
+ var self2 = this;
24422
+ this._processing = 0;
24423
+ this._emitQueue = [];
24424
+ this._processQueue = [];
24425
+ this.paused = false;
24426
+ if (this.noprocess)
24427
+ return this;
24428
+ if (n === 0)
24429
+ return done();
24430
+ var sync = true;
24431
+ for (var i = 0; i < n; i++) {
24432
+ this._process(this.minimatch.set[i], i, false, done);
24433
+ }
24434
+ sync = false;
24435
+ function done() {
24436
+ --self2._processing;
24437
+ if (self2._processing <= 0) {
24438
+ if (sync) {
24439
+ process.nextTick(function() {
24440
+ self2._finish();
24441
+ });
24442
+ } else {
24443
+ self2._finish();
24444
+ }
24445
+ }
24446
+ }
24447
+ }
24448
+ Glob.prototype._finish = function() {
24449
+ assert(this instanceof Glob);
24450
+ if (this.aborted)
24451
+ return;
24452
+ if (this.realpath && !this._didRealpath)
24453
+ return this._realpath();
24454
+ common.finish(this);
24455
+ this.emit("end", this.found);
24456
+ };
24457
+ Glob.prototype._realpath = function() {
24458
+ if (this._didRealpath)
24459
+ return;
24460
+ this._didRealpath = true;
24461
+ var n = this.matches.length;
24462
+ if (n === 0)
24463
+ return this._finish();
24464
+ var self2 = this;
24465
+ for (var i = 0; i < this.matches.length; i++)
24466
+ this._realpathSet(i, next);
24467
+ function next() {
24468
+ if (--n === 0)
24469
+ self2._finish();
24470
+ }
24471
+ };
24472
+ Glob.prototype._realpathSet = function(index4, cb) {
24473
+ var matchset = this.matches[index4];
24474
+ if (!matchset)
24475
+ return cb();
24476
+ var found = Object.keys(matchset);
24477
+ var self2 = this;
24478
+ var n = found.length;
24479
+ if (n === 0)
24480
+ return cb();
24481
+ var set = this.matches[index4] = /* @__PURE__ */ Object.create(null);
24482
+ found.forEach(function(p, i) {
24483
+ p = self2._makeAbs(p);
24484
+ rp.realpath(p, self2.realpathCache, function(er, real) {
24485
+ if (!er)
24486
+ set[real] = true;
24487
+ else if (er.syscall === "stat")
24488
+ set[p] = true;
24489
+ else
24490
+ self2.emit("error", er);
24491
+ if (--n === 0) {
24492
+ self2.matches[index4] = set;
24493
+ cb();
24494
+ }
24495
+ });
24496
+ });
24497
+ };
24498
+ Glob.prototype._mark = function(p) {
24499
+ return common.mark(this, p);
24500
+ };
24501
+ Glob.prototype._makeAbs = function(f) {
24502
+ return common.makeAbs(this, f);
24503
+ };
24504
+ Glob.prototype.abort = function() {
24505
+ this.aborted = true;
24506
+ this.emit("abort");
24507
+ };
24508
+ Glob.prototype.pause = function() {
24509
+ if (!this.paused) {
24510
+ this.paused = true;
24511
+ this.emit("pause");
24512
+ }
24513
+ };
24514
+ Glob.prototype.resume = function() {
24515
+ if (this.paused) {
24516
+ this.emit("resume");
24517
+ this.paused = false;
24518
+ if (this._emitQueue.length) {
24519
+ var eq = this._emitQueue.slice(0);
24520
+ this._emitQueue.length = 0;
24521
+ for (var i = 0; i < eq.length; i++) {
24522
+ var e = eq[i];
24523
+ this._emitMatch(e[0], e[1]);
24524
+ }
24525
+ }
24526
+ if (this._processQueue.length) {
24527
+ var pq = this._processQueue.slice(0);
24528
+ this._processQueue.length = 0;
24529
+ for (var i = 0; i < pq.length; i++) {
24530
+ var p = pq[i];
24531
+ this._processing--;
24532
+ this._process(p[0], p[1], p[2], p[3]);
24533
+ }
24534
+ }
24535
+ }
24536
+ };
24537
+ Glob.prototype._process = function(pattern, index4, inGlobStar, cb) {
24538
+ assert(this instanceof Glob);
24539
+ assert(typeof cb === "function");
24540
+ if (this.aborted)
24541
+ return;
24542
+ this._processing++;
24543
+ if (this.paused) {
24544
+ this._processQueue.push([pattern, index4, inGlobStar, cb]);
24545
+ return;
24546
+ }
24547
+ var n = 0;
24548
+ while (typeof pattern[n] === "string") {
24549
+ n++;
24550
+ }
24551
+ var prefix;
24552
+ switch (n) {
24553
+ case pattern.length:
24554
+ this._processSimple(pattern.join("/"), index4, cb);
24555
+ return;
24556
+ case 0:
24557
+ prefix = null;
24558
+ break;
24559
+ default:
24560
+ prefix = pattern.slice(0, n).join("/");
24561
+ break;
24562
+ }
24563
+ var remain = pattern.slice(n);
24564
+ var read;
24565
+ if (prefix === null)
24566
+ read = ".";
24567
+ else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
24568
+ return typeof p === "string" ? p : "[*]";
24569
+ }).join("/"))) {
24570
+ if (!prefix || !isAbsolute(prefix))
24571
+ prefix = "/" + prefix;
24572
+ read = prefix;
24573
+ } else
24574
+ read = prefix;
24575
+ var abs = this._makeAbs(read);
24576
+ if (childrenIgnored(this, read))
24577
+ return cb();
24578
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
24579
+ if (isGlobStar)
24580
+ this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar, cb);
24581
+ else
24582
+ this._processReaddir(prefix, read, abs, remain, index4, inGlobStar, cb);
24583
+ };
24584
+ Glob.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
24585
+ var self2 = this;
24586
+ this._readdir(abs, inGlobStar, function(er, entries) {
24587
+ return self2._processReaddir2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
24588
+ });
24589
+ };
24590
+ Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
24591
+ if (!entries)
24592
+ return cb();
24593
+ var pn = remain[0];
24594
+ var negate = !!this.minimatch.negate;
24595
+ var rawGlob = pn._glob;
24596
+ var dotOk = this.dot || rawGlob.charAt(0) === ".";
24597
+ var matchedEntries = [];
24598
+ for (var i = 0; i < entries.length; i++) {
24599
+ var e = entries[i];
24600
+ if (e.charAt(0) !== "." || dotOk) {
24601
+ var m;
24602
+ if (negate && !prefix) {
24603
+ m = !e.match(pn);
24604
+ } else {
24605
+ m = e.match(pn);
24606
+ }
24607
+ if (m)
24608
+ matchedEntries.push(e);
24609
+ }
24610
+ }
24611
+ var len = matchedEntries.length;
24612
+ if (len === 0)
24613
+ return cb();
24614
+ if (remain.length === 1 && !this.mark && !this.stat) {
24615
+ if (!this.matches[index4])
24616
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24617
+ for (var i = 0; i < len; i++) {
24618
+ var e = matchedEntries[i];
24619
+ if (prefix) {
24620
+ if (prefix !== "/")
24621
+ e = prefix + "/" + e;
24622
+ else
24623
+ e = prefix + e;
24624
+ }
24625
+ if (e.charAt(0) === "/" && !this.nomount) {
24626
+ e = path4.join(this.root, e);
24627
+ }
24628
+ this._emitMatch(index4, e);
24629
+ }
24630
+ return cb();
24631
+ }
24632
+ remain.shift();
24633
+ for (var i = 0; i < len; i++) {
24634
+ var e = matchedEntries[i];
24635
+ var newPattern;
24636
+ if (prefix) {
24637
+ if (prefix !== "/")
24638
+ e = prefix + "/" + e;
24639
+ else
24640
+ e = prefix + e;
24641
+ }
24642
+ this._process([e].concat(remain), index4, inGlobStar, cb);
24643
+ }
24644
+ cb();
24645
+ };
24646
+ Glob.prototype._emitMatch = function(index4, e) {
24647
+ if (this.aborted)
24648
+ return;
24649
+ if (isIgnored(this, e))
24650
+ return;
24651
+ if (this.paused) {
24652
+ this._emitQueue.push([index4, e]);
24653
+ return;
24654
+ }
24655
+ var abs = isAbsolute(e) ? e : this._makeAbs(e);
24656
+ if (this.mark)
24657
+ e = this._mark(e);
24658
+ if (this.absolute)
24659
+ e = abs;
24660
+ if (this.matches[index4][e])
24661
+ return;
24662
+ if (this.nodir) {
24663
+ var c = this.cache[abs];
24664
+ if (c === "DIR" || Array.isArray(c))
24665
+ return;
24666
+ }
24667
+ this.matches[index4][e] = true;
24668
+ var st = this.statCache[abs];
24669
+ if (st)
24670
+ this.emit("stat", e, st);
24671
+ this.emit("match", e);
24672
+ };
24673
+ Glob.prototype._readdirInGlobStar = function(abs, cb) {
24674
+ if (this.aborted)
24675
+ return;
24676
+ if (this.follow)
24677
+ return this._readdir(abs, false, cb);
24678
+ var lstatkey = "lstat\0" + abs;
24679
+ var self2 = this;
24680
+ var lstatcb = inflight(lstatkey, lstatcb_);
24681
+ if (lstatcb)
24682
+ self2.fs.lstat(abs, lstatcb);
24683
+ function lstatcb_(er, lstat) {
24684
+ if (er && er.code === "ENOENT")
24685
+ return cb();
24686
+ var isSym = lstat && lstat.isSymbolicLink();
24687
+ self2.symlinks[abs] = isSym;
24688
+ if (!isSym && lstat && !lstat.isDirectory()) {
24689
+ self2.cache[abs] = "FILE";
24690
+ cb();
24691
+ } else
24692
+ self2._readdir(abs, false, cb);
24693
+ }
24694
+ };
24695
+ Glob.prototype._readdir = function(abs, inGlobStar, cb) {
24696
+ if (this.aborted)
24697
+ return;
24698
+ cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
24699
+ if (!cb)
24700
+ return;
24701
+ if (inGlobStar && !ownProp(this.symlinks, abs))
24702
+ return this._readdirInGlobStar(abs, cb);
24703
+ if (ownProp(this.cache, abs)) {
24704
+ var c = this.cache[abs];
24705
+ if (!c || c === "FILE")
24706
+ return cb();
24707
+ if (Array.isArray(c))
24708
+ return cb(null, c);
24709
+ }
24710
+ var self2 = this;
24711
+ self2.fs.readdir(abs, readdirCb(this, abs, cb));
24712
+ };
24713
+ function readdirCb(self2, abs, cb) {
24714
+ return function(er, entries) {
24715
+ if (er)
24716
+ self2._readdirError(abs, er, cb);
24717
+ else
24718
+ self2._readdirEntries(abs, entries, cb);
24719
+ };
24720
+ }
24721
+ Glob.prototype._readdirEntries = function(abs, entries, cb) {
24722
+ if (this.aborted)
24723
+ return;
24724
+ if (!this.mark && !this.stat) {
24725
+ for (var i = 0; i < entries.length; i++) {
24726
+ var e = entries[i];
24727
+ if (abs === "/")
24728
+ e = abs + e;
24729
+ else
24730
+ e = abs + "/" + e;
24731
+ this.cache[e] = true;
24732
+ }
24733
+ }
24734
+ this.cache[abs] = entries;
24735
+ return cb(null, entries);
24736
+ };
24737
+ Glob.prototype._readdirError = function(f, er, cb) {
24738
+ if (this.aborted)
24739
+ return;
24740
+ switch (er.code) {
24741
+ case "ENOTSUP":
24742
+ case "ENOTDIR":
24743
+ var abs = this._makeAbs(f);
24744
+ this.cache[abs] = "FILE";
24745
+ if (abs === this.cwdAbs) {
24746
+ var error2 = new Error(er.code + " invalid cwd " + this.cwd);
24747
+ error2.path = this.cwd;
24748
+ error2.code = er.code;
24749
+ this.emit("error", error2);
24750
+ this.abort();
24751
+ }
24752
+ break;
24753
+ case "ENOENT":
24754
+ case "ELOOP":
24755
+ case "ENAMETOOLONG":
24756
+ case "UNKNOWN":
24757
+ this.cache[this._makeAbs(f)] = false;
24758
+ break;
24759
+ default:
24760
+ this.cache[this._makeAbs(f)] = false;
24761
+ if (this.strict) {
24762
+ this.emit("error", er);
24763
+ this.abort();
24764
+ }
24765
+ if (!this.silent)
24766
+ console.error("glob error", er);
24767
+ break;
24768
+ }
24769
+ return cb();
24770
+ };
24771
+ Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
24772
+ var self2 = this;
24773
+ this._readdir(abs, inGlobStar, function(er, entries) {
24774
+ self2._processGlobStar2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
24775
+ });
24776
+ };
24777
+ Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
24778
+ if (!entries)
24779
+ return cb();
24780
+ var remainWithoutGlobStar = remain.slice(1);
24781
+ var gspref = prefix ? [prefix] : [];
24782
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
24783
+ this._process(noGlobStar, index4, false, cb);
24784
+ var isSym = this.symlinks[abs];
24785
+ var len = entries.length;
24786
+ if (isSym && inGlobStar)
24787
+ return cb();
24788
+ for (var i = 0; i < len; i++) {
24789
+ var e = entries[i];
24790
+ if (e.charAt(0) === "." && !this.dot)
24791
+ continue;
24792
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
24793
+ this._process(instead, index4, true, cb);
24794
+ var below = gspref.concat(entries[i], remain);
24795
+ this._process(below, index4, true, cb);
24796
+ }
24797
+ cb();
24798
+ };
24799
+ Glob.prototype._processSimple = function(prefix, index4, cb) {
24800
+ var self2 = this;
24801
+ this._stat(prefix, function(er, exists) {
24802
+ self2._processSimple2(prefix, index4, er, exists, cb);
24803
+ });
24804
+ };
24805
+ Glob.prototype._processSimple2 = function(prefix, index4, er, exists, cb) {
24806
+ if (!this.matches[index4])
24807
+ this.matches[index4] = /* @__PURE__ */ Object.create(null);
24808
+ if (!exists)
24809
+ return cb();
24810
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
24811
+ var trail = /[\/\\]$/.test(prefix);
24812
+ if (prefix.charAt(0) === "/") {
24813
+ prefix = path4.join(this.root, prefix);
24814
+ } else {
24815
+ prefix = path4.resolve(this.root, prefix);
24816
+ if (trail)
24817
+ prefix += "/";
24818
+ }
24819
+ }
24820
+ if (process.platform === "win32")
24821
+ prefix = prefix.replace(/\\/g, "/");
24822
+ this._emitMatch(index4, prefix);
24823
+ cb();
24824
+ };
24825
+ Glob.prototype._stat = function(f, cb) {
24826
+ var abs = this._makeAbs(f);
24827
+ var needDir = f.slice(-1) === "/";
24828
+ if (f.length > this.maxLength)
24829
+ return cb();
24830
+ if (!this.stat && ownProp(this.cache, abs)) {
24831
+ var c = this.cache[abs];
24832
+ if (Array.isArray(c))
24833
+ c = "DIR";
24834
+ if (!needDir || c === "DIR")
24835
+ return cb(null, c);
24836
+ if (needDir && c === "FILE")
24837
+ return cb();
24838
+ }
24839
+ var exists;
24840
+ var stat = this.statCache[abs];
24841
+ if (stat !== void 0) {
24842
+ if (stat === false)
24843
+ return cb(null, stat);
24844
+ else {
24845
+ var type = stat.isDirectory() ? "DIR" : "FILE";
24846
+ if (needDir && type === "FILE")
24847
+ return cb();
24848
+ else
24849
+ return cb(null, type, stat);
24850
+ }
24851
+ }
24852
+ var self2 = this;
24853
+ var statcb = inflight("stat\0" + abs, lstatcb_);
24854
+ if (statcb)
24855
+ self2.fs.lstat(abs, statcb);
24856
+ function lstatcb_(er, lstat) {
24857
+ if (lstat && lstat.isSymbolicLink()) {
24858
+ return self2.fs.stat(abs, function(er2, stat2) {
24859
+ if (er2)
24860
+ self2._stat2(f, abs, null, lstat, cb);
24861
+ else
24862
+ self2._stat2(f, abs, er2, stat2, cb);
24863
+ });
24864
+ } else {
24865
+ self2._stat2(f, abs, er, lstat, cb);
24866
+ }
24867
+ }
24868
+ };
24869
+ Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
24870
+ if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
24871
+ this.statCache[abs] = false;
24872
+ return cb();
24873
+ }
24874
+ var needDir = f.slice(-1) === "/";
24875
+ this.statCache[abs] = stat;
24876
+ if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
24877
+ return cb(null, false, stat);
24878
+ var c = true;
24879
+ if (stat)
24880
+ c = stat.isDirectory() ? "DIR" : "FILE";
24881
+ this.cache[abs] = this.cache[abs] || c;
24882
+ if (needDir && c === "FILE")
24883
+ return cb();
24884
+ return cb(null, c, stat);
24885
+ };
24886
+ }
24887
+ });
24888
+
22286
24889
  // src/serializer/mysqlImports.ts
22287
24890
  var mysqlImports_exports = {};
22288
24891
  __export(mysqlImports_exports, {
@@ -22339,7 +24942,7 @@ function clearDefaults(defaultValue, collate) {
22339
24942
  return `(${resultDefault})`;
22340
24943
  }
22341
24944
  }
22342
- var import_mysql_core2, import_table, import_utils7, import_sql, import_common, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
24945
+ var import_mysql_core2, import_table, import_utils7, import_sql, import_common, import_date, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
22343
24946
  var init_mysqlSerializer = __esm({
22344
24947
  "src/serializer/mysqlSerializer.ts"() {
22345
24948
  import_mysql_core2 = require("drizzle-orm/mysql-core");
@@ -22347,6 +24950,7 @@ var init_mysqlSerializer = __esm({
22347
24950
  import_utils7 = require("drizzle-orm/mysql-core/utils");
22348
24951
  import_sql = require("drizzle-orm/sql");
22349
24952
  import_common = require("drizzle-orm/mysql-core/columns/common");
24953
+ import_date = require("drizzle-orm/mysql-core/columns/date.common");
22350
24954
  dialect3 = new import_mysql_core2.MySqlDialect();
22351
24955
  indexName = (tableName, columns) => {
22352
24956
  return `${tableName}_${columns.join("_")}_index`;
@@ -22367,12 +24971,14 @@ var init_mysqlSerializer = __esm({
22367
24971
  columns.forEach((column6) => {
22368
24972
  const notNull = column6.notNull;
22369
24973
  const primaryKey = column6.primary;
24974
+ const sqlTypeLowered = column6.getSQLType().toLowerCase();
22370
24975
  const columnToSet = {
22371
24976
  name: column6.name,
22372
24977
  type: column6.getSQLType(),
22373
24978
  primaryKey,
22374
24979
  notNull,
22375
- autoincrement: column6 instanceof import_common.MySqlColumnWithAutoIncrement ? column6.autoIncrement : false
24980
+ autoincrement: column6 instanceof import_common.MySqlColumnWithAutoIncrement ? column6.autoIncrement : false,
24981
+ onUpdate: column6 instanceof import_date.MySqlDateBaseColumn ? column6.hasOnUpdateNow : void 0
22376
24982
  };
22377
24983
  if (column6.default !== void 0) {
22378
24984
  if (column6.default instanceof import_sql.SQL) {
@@ -22383,7 +24989,17 @@ var init_mysqlSerializer = __esm({
22383
24989
  throw new Error();
22384
24990
  }).join();
22385
24991
  } else {
22386
- columnToSet.default = typeof column6.default === "string" ? `'${column6.default}'` : column6.default;
24992
+ if (typeof column6.default === "string") {
24993
+ columnToSet.default = `"${column6.default}"`;
24994
+ } else {
24995
+ if (sqlTypeLowered === "json") {
24996
+ columnToSet.default = `'${JSON.stringify(column6.default)}'`;
24997
+ } else if (column6.default instanceof Date) {
24998
+ columnToSet.default = `'${column6.default.toISOString()}'`;
24999
+ } else {
25000
+ columnToSet.default = column6.default;
25001
+ }
25002
+ }
22387
25003
  }
22388
25004
  if (["blob", "text", "json"].includes(column6.getSQLType())) {
22389
25005
  columnToSet.default = `(${columnToSet.default})`;
@@ -22457,10 +25073,10 @@ var init_mysqlSerializer = __esm({
22457
25073
  }
22458
25074
  };
22459
25075
  };
22460
- fromDatabase = async (db, schema4, progressCallback) => {
25076
+ fromDatabase = async (db, inputSchema, progressCallback) => {
22461
25077
  const result = {};
22462
25078
  const columns = await db.execute(`select * from information_schema.columns
22463
- where table_schema = '${schema4}'
25079
+ where table_schema = '${inputSchema}' and table_name != '__drizzle_migrations'
22464
25080
  order by table_name, ordinal_position;`);
22465
25081
  const response = columns[0];
22466
25082
  const schemas = [];
@@ -22471,9 +25087,9 @@ var init_mysqlSerializer = __esm({
22471
25087
  for (const column6 of response) {
22472
25088
  columnsCount += 1;
22473
25089
  progressCallback("columns", columnsCount, "fetching");
22474
- const schema5 = column6["TABLE_SCHEMA"];
25090
+ const schema4 = column6["TABLE_SCHEMA"];
22475
25091
  const tableName = column6["TABLE_NAME"];
22476
- tablesCount.add(`${schema5}.${tableName}`);
25092
+ tablesCount.add(`${schema4}.${tableName}`);
22477
25093
  progressCallback("columns", tablesCount.size, "fetching");
22478
25094
  const columnName = column6["COLUMN_NAME"];
22479
25095
  const isNullable = column6["IS_NULLABLE"] === "YES";
@@ -22484,7 +25100,9 @@ var init_mysqlSerializer = __esm({
22484
25100
  const isDefaultAnExpression = column6["EXTRA"] === "DEFAULT_GENERATED";
22485
25101
  const columnDefault = column6["COLUMN_DEFAULT"];
22486
25102
  const collation = column6["CHARACTER_SET_NAME"];
22487
- schemas.push(schema5);
25103
+ if (schema4 !== inputSchema) {
25104
+ schemas.push(schema4);
25105
+ }
22488
25106
  const table4 = result[tableName];
22489
25107
  const newColumn = {
22490
25108
  default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : isDefaultAnExpression ? clearDefaults(columnDefault, collation) : `"${columnDefault}"`,
@@ -22497,7 +25115,7 @@ var init_mysqlSerializer = __esm({
22497
25115
  if (!table4) {
22498
25116
  result[tableName] = {
22499
25117
  name: tableName,
22500
- schema: schema5,
25118
+ schema: schema4 !== inputSchema ? schema4 : void 0,
22501
25119
  columns: {
22502
25120
  [columnName]: newColumn
22503
25121
  },
@@ -22510,56 +25128,62 @@ var init_mysqlSerializer = __esm({
22510
25128
  }
22511
25129
  progressCallback("columns", columnsCount, "done");
22512
25130
  progressCallback("tables", tablesCount.size, "done");
22513
- const fks = await db.execute(
22514
- `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
25131
+ try {
25132
+ const fks = await db.execute(
25133
+ `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
22515
25134
  FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
22516
25135
  LEFT JOIN information_schema.referential_constraints on information_schema.referential_constraints.constraint_name = information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME
22517
25136
  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;
22518
25137
  `,
22519
- [schema4]
22520
- );
22521
- const fkRows = fks[0];
22522
- for (const fkRow of fkRows) {
22523
- foreignKeysCount += 1;
22524
- progressCallback("fks", foreignKeysCount, "fetching");
22525
- const tableSchema = fkRow["TABLE_SCHEMA"];
22526
- const tableName = fkRow["TABLE_NAME"];
22527
- const constraintName = fkRow["CONSTRAINT_NAME"];
22528
- const columnName = fkRow["COLUMN_NAME"];
22529
- const refTableSchema = fkRow["REFERENCED_TABLE_SCHEMA"];
22530
- const refTableName = fkRow["REFERENCED_TABLE_NAME"];
22531
- const refColumnName = fkRow["REFERENCED_COLUMN_NAME"];
22532
- const updateRule = fkRow["UPDATE_RULE"];
22533
- const deleteRule = fkRow["DELETE_RULE"];
22534
- const tableInResult = result[tableName];
22535
- if (typeof tableInResult === "undefined")
22536
- continue;
22537
- if (typeof tableInResult.foreignKeys[constraintName] !== "undefined") {
22538
- tableInResult.foreignKeys[constraintName].columnsFrom.push(columnName);
22539
- tableInResult.foreignKeys[constraintName].columnsTo.push(refColumnName);
22540
- } else {
22541
- tableInResult.foreignKeys[constraintName] = {
22542
- name: constraintName,
22543
- tableFrom: tableName,
22544
- tableTo: refTableName,
22545
- columnsFrom: [columnName],
22546
- columnsTo: [refColumnName],
22547
- onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
22548
- onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
22549
- };
25138
+ [inputSchema]
25139
+ );
25140
+ const fkRows = fks[0];
25141
+ for (const fkRow of fkRows) {
25142
+ foreignKeysCount += 1;
25143
+ progressCallback("fks", foreignKeysCount, "fetching");
25144
+ const tableSchema = fkRow["TABLE_SCHEMA"];
25145
+ const tableName = fkRow["TABLE_NAME"];
25146
+ const constraintName = fkRow["CONSTRAINT_NAME"];
25147
+ const columnName = fkRow["COLUMN_NAME"];
25148
+ const refTableSchema = fkRow["REFERENCED_TABLE_SCHEMA"];
25149
+ const refTableName = fkRow["REFERENCED_TABLE_NAME"];
25150
+ const refColumnName = fkRow["REFERENCED_COLUMN_NAME"];
25151
+ const updateRule = fkRow["UPDATE_RULE"];
25152
+ const deleteRule = fkRow["DELETE_RULE"];
25153
+ const tableInResult = result[tableName];
25154
+ if (typeof tableInResult === "undefined")
25155
+ continue;
25156
+ if (typeof tableInResult.foreignKeys[constraintName] !== "undefined") {
25157
+ tableInResult.foreignKeys[constraintName].columnsFrom.push(columnName);
25158
+ tableInResult.foreignKeys[constraintName].columnsTo.push(
25159
+ refColumnName
25160
+ );
25161
+ } else {
25162
+ tableInResult.foreignKeys[constraintName] = {
25163
+ name: constraintName,
25164
+ tableFrom: tableName,
25165
+ tableTo: refTableName,
25166
+ columnsFrom: [columnName],
25167
+ columnsTo: [refColumnName],
25168
+ onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
25169
+ onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
25170
+ };
25171
+ }
25172
+ tableInResult.foreignKeys[constraintName].columnsFrom = [
25173
+ ...new Set(tableInResult.foreignKeys[constraintName].columnsFrom)
25174
+ ];
25175
+ tableInResult.foreignKeys[constraintName].columnsTo = [
25176
+ ...new Set(tableInResult.foreignKeys[constraintName].columnsTo)
25177
+ ];
22550
25178
  }
22551
- tableInResult.foreignKeys[constraintName].columnsFrom = [
22552
- ...new Set(tableInResult.foreignKeys[constraintName].columnsFrom)
22553
- ];
22554
- tableInResult.foreignKeys[constraintName].columnsTo = [
22555
- ...new Set(tableInResult.foreignKeys[constraintName].columnsTo)
22556
- ];
25179
+ } catch (e) {
25180
+ console.log(`Can't proccess foreign keys`);
22557
25181
  }
22558
25182
  progressCallback("fks", foreignKeysCount, "done");
22559
25183
  const idxs = await db.execute(
22560
25184
  `select * from INFORMATION_SCHEMA.STATISTICS
22561
25185
  WHERE INFORMATION_SCHEMA.STATISTICS.TABLE_SCHEMA = ? and INFORMATION_SCHEMA.STATISTICS.INDEX_NAME != 'PRIMARY';`,
22562
- [schema4]
25186
+ [inputSchema]
22563
25187
  );
22564
25188
  const idxRows = idxs[0];
22565
25189
  for (const idxRow of idxRows) {
@@ -23167,12 +25791,13 @@ var init_sqliteSerializer = __esm({
23167
25791
  });
23168
25792
 
23169
25793
  // src/serializer/index.ts
23170
- var import_fs3, import_node, import_path3, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
25794
+ var import_fs3, import_node, import_path3, import_glob, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
23171
25795
  var init_serializer = __esm({
23172
25796
  "src/serializer/index.ts"() {
23173
25797
  import_fs3 = __toESM(require("fs"));
23174
25798
  import_node = __toESM(require_node2());
23175
25799
  import_path3 = __toESM(require("path"));
25800
+ import_glob = __toESM(require_glob());
23176
25801
  safeRegister = () => {
23177
25802
  try {
23178
25803
  const { unregister } = (0, import_node.register)({
@@ -23213,9 +25838,19 @@ var init_serializer = __esm({
23213
25838
  return generateSqliteSnapshot2(tables, enums);
23214
25839
  };
23215
25840
  prepareFilenames = (path4) => {
23216
- const fileName = import_fs3.default.lstatSync(path4).isDirectory() ? null : import_path3.default.resolve(path4);
23217
- const filenames = fileName ? [fileName] : import_fs3.default.readdirSync(path4).map((it) => import_path3.default.join(import_path3.default.resolve(path4), it));
23218
- return filenames;
25841
+ if (typeof path4 === "string") {
25842
+ path4 = [path4];
25843
+ }
25844
+ const result = path4.reduce((result2, cur) => {
25845
+ const globbed = import_glob.default.sync(cur);
25846
+ globbed.forEach((it) => {
25847
+ const fileName = import_fs3.default.lstatSync(it).isDirectory() ? null : import_path3.default.resolve(it);
25848
+ const filenames = fileName ? [fileName] : import_fs3.default.readdirSync(it).map((file) => import_path3.default.join(import_path3.default.resolve(it), file));
25849
+ filenames.filter((file) => !import_fs3.default.lstatSync(file).isDirectory()).forEach((file) => result2.add(file));
25850
+ });
25851
+ return result2;
25852
+ }, /* @__PURE__ */ new Set());
25853
+ return [...result];
23219
25854
  };
23220
25855
  }
23221
25856
  });
@@ -23324,7 +25959,6 @@ var init_migrate = __esm({
23324
25959
  writeResult(
23325
25960
  cur,
23326
25961
  sqlStatements,
23327
- snapshots.length,
23328
25962
  journal,
23329
25963
  _meta,
23330
25964
  outFolder,
@@ -23353,7 +25987,6 @@ var init_migrate = __esm({
23353
25987
  writeResult(
23354
25988
  cur,
23355
25989
  sqlStatements,
23356
- snapshots.length,
23357
25990
  journal,
23358
25991
  _meta,
23359
25992
  outFolder,
@@ -23382,7 +26015,6 @@ var init_migrate = __esm({
23382
26015
  writeResult(
23383
26016
  cur,
23384
26017
  sqlStatements,
23385
- snapshots.length,
23386
26018
  journal,
23387
26019
  _meta,
23388
26020
  outFolder,
@@ -23572,12 +26204,14 @@ var init_migrate = __esm({
23572
26204
  result.deleted.push(...leftMissing);
23573
26205
  return result;
23574
26206
  };
23575
- writeResult = (cur, sqlStatements, idx, journal, _meta, outFolder, breakpoints) => {
26207
+ writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints) => {
26208
+ var _a, _b;
23576
26209
  console.log(schema(cur));
23577
26210
  if (sqlStatements.length === 0) {
23578
26211
  console.log("No schema changes, nothing to migrate \u{1F634}");
23579
26212
  return;
23580
26213
  }
26214
+ const idx = (_b = (_a = journal.entries[journal.entries.length - 1]) == null ? void 0 : _a.idx) != null ? _b : 0;
23581
26215
  const { prefix, tag } = prepareMigrationMetadata(idx);
23582
26216
  const toSave = JSON.parse(JSON.stringify(cur));
23583
26217
  toSave["_meta"] = _meta;
@@ -28485,10 +31119,10 @@ __export(pgIntrospect_exports, {
28485
31119
  PgConfig2: () => PgConfig2,
28486
31120
  pgIntrospect: () => pgIntrospect
28487
31121
  });
28488
- var import_hanji3, import_pg, PgConfig1, PgConfig2, Conf, pgIntrospect;
31122
+ var import_hanji4, import_pg, PgConfig1, PgConfig2, Conf, pgIntrospect;
28489
31123
  var init_pgIntrospect = __esm({
28490
31124
  "src/cli/commands/pgIntrospect.ts"() {
28491
- import_hanji3 = __toESM(require_hanji());
31125
+ import_hanji4 = __toESM(require_hanji());
28492
31126
  init_lib();
28493
31127
  init_views();
28494
31128
  import_pg = __toESM(require_lib3());
@@ -28510,7 +31144,7 @@ var init_pgIntrospect = __esm({
28510
31144
  pgIntrospect = async (config) => {
28511
31145
  const pool = new import_pg.Pool(config);
28512
31146
  const progress = new IntrospectProgress();
28513
- const res = await (0, import_hanji3.renderWithTask)(
31147
+ const res = await (0, import_hanji4.renderWithTask)(
28514
31148
  progress,
28515
31149
  fromDatabase2(pool, (stage, count, status) => {
28516
31150
  progress.update(stage, count, status);
@@ -42809,7 +45443,7 @@ var require_named_placeholders = __commonJS({
42809
45443
  }
42810
45444
  return s;
42811
45445
  }
42812
- function join4(tree) {
45446
+ function join5(tree) {
42813
45447
  if (tree.length == 1) {
42814
45448
  return tree;
42815
45449
  }
@@ -42835,7 +45469,7 @@ var require_named_placeholders = __commonJS({
42835
45469
  if (cache && (tree = cache.get(query))) {
42836
45470
  return toArrayParams(tree, paramsObj);
42837
45471
  }
42838
- tree = join4(parse(query));
45472
+ tree = join5(parse(query));
42839
45473
  if (cache) {
42840
45474
  cache.set(query, tree);
42841
45475
  }
@@ -44839,13 +47473,13 @@ var init_mysql_introspect = __esm({
44839
47473
  },
44840
47474
  { mysql: [] }
44841
47475
  );
44842
- const schemaStatements = Object.entries(schemas).filter((it) => it[0] !== "public").map((it) => {
47476
+ const schemaStatements = Object.entries(schemas).map((it) => {
44843
47477
  return `export const ${it[1]} = mysqlSchema("${it[0]}");
44844
47478
  `;
44845
47479
  }).join();
44846
47480
  const tableStatements = Object.values(schema4.tables).map((table4) => {
44847
47481
  const schema5 = schemas[table4.schema];
44848
- const func = schema5 || schema5 === "public" ? "mysqlTable" : schema5;
47482
+ const func = schema5 ? schema5 : "mysqlTable";
44849
47483
  let statement = "";
44850
47484
  if (imports.mysql.includes(table4.name.camelCase())) {
44851
47485
  statement = `// Table name is in conflict with ${table4.name.camelCase()} import.
@@ -45148,10 +47782,10 @@ __export(mysqlIntrospect_exports, {
45148
47782
  MySQLConfig2: () => MySQLConfig2,
45149
47783
  mysqlIntrospect: () => mysqlIntrospect
45150
47784
  });
45151
- var import_hanji4, import_promise, MySQLConfig1, MySQLConfig2, Conf2, mysqlIntrospect;
47785
+ var import_hanji5, import_promise, MySQLConfig1, MySQLConfig2, Conf2, mysqlIntrospect;
45152
47786
  var init_mysqlIntrospect = __esm({
45153
47787
  "src/cli/commands/mysqlIntrospect.ts"() {
45154
- import_hanji4 = __toESM(require_hanji());
47788
+ import_hanji5 = __toESM(require_hanji());
45155
47789
  init_lib();
45156
47790
  init_views();
45157
47791
  import_promise = __toESM(require_promise2());
@@ -45175,16 +47809,21 @@ var init_mysqlIntrospect = __esm({
45175
47809
  if (typeof config.connectionString !== "undefined") {
45176
47810
  const connection = config.connectionString;
45177
47811
  client = await (0, import_promise.createConnection)(connection);
45178
- databaseName = connection.split("/")[connection.split("/").length - 1];
47812
+ const connectionUrl = new URL(connection);
47813
+ const pathname = connectionUrl.pathname;
47814
+ databaseName = pathname.split("/")[pathname.split("/").length - 1];
45179
47815
  } else {
45180
47816
  client = await (0, import_promise.createConnection)(config);
45181
47817
  databaseName = config.database;
45182
47818
  }
45183
47819
  await client.connect();
45184
47820
  const progress = new IntrospectProgress();
45185
- const res = await (0, import_hanji4.renderWithTask)(progress, fromDatabase(client, databaseName, (stage, count, status) => {
45186
- progress.update(stage, count, status);
45187
- }));
47821
+ const res = await (0, import_hanji5.renderWithTask)(
47822
+ progress,
47823
+ fromDatabase(client, databaseName, (stage, count, status) => {
47824
+ progress.update(stage, count, status);
47825
+ })
47826
+ );
45188
47827
  const schema4 = { id: originUUID, prevId: "", ...res };
45189
47828
  const ts = schemaToTypeScript2(schema4);
45190
47829
  return { schema: schema4, ts };
@@ -45217,7 +47856,7 @@ var {
45217
47856
  } = import_index.default;
45218
47857
 
45219
47858
  // src/cli/index.ts
45220
- var import_fs9 = __toESM(require("fs"));
47859
+ var import_fs10 = __toESM(require("fs"));
45221
47860
  init_lib();
45222
47861
 
45223
47862
  // src/cli/commands/check.ts
@@ -45258,9 +47897,9 @@ var checkHandler = (out, dialect6) => {
45258
47897
  };
45259
47898
 
45260
47899
  // src/cli/index.ts
45261
- var import_hanji5 = __toESM(require_hanji());
47900
+ var import_hanji6 = __toESM(require_hanji());
45262
47901
  init_views();
45263
- var import_path7 = __toESM(require("path"));
47902
+ var import_path8 = __toESM(require("path"));
45264
47903
 
45265
47904
  // src/cli/utils.ts
45266
47905
  init_views();
@@ -45309,15 +47948,16 @@ var package_default = {
45309
47948
  name: "drizzle-kit",
45310
47949
  version: "0.16.9",
45311
47950
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
45312
- author: "Alex Blokh <aleksandrblokh@gmail.com>",
47951
+ author: "Drizzle Team",
45313
47952
  license: "MIT",
45314
47953
  bin: {
45315
47954
  "drizzle-kit": "./index.js"
45316
47955
  },
45317
47956
  scripts: {
45318
47957
  "start:pg": "node -r esbuild-register ./src/cli/index.ts generate --out ./dev/migrations --dialect pg --schema ./dev/data",
47958
+ "start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql --out ./dev/migrations --schema ./dev/migrations/schema.ts",
45319
47959
  "check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
45320
- "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",
47960
+ "introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --out ./dev/migrations --connectionString ",
45321
47961
  "up:pg": "node -r esbuild-register ./src/cli/index.ts up --out ./dev/equedi --dialect pg",
45322
47962
  "check:equedi": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/equedi --dialect pg",
45323
47963
  run: "node -r esbuild-register index.ts",
@@ -45353,12 +47993,14 @@ var package_default = {
45353
47993
  commander: "^9.4.1",
45354
47994
  esbuild: "^0.15.18",
45355
47995
  "esbuild-register": "^3.4.2",
47996
+ glob: "^8.1.0",
45356
47997
  hanji: "^0.0.5",
45357
47998
  "json-diff": "0.9.0",
45358
47999
  zod: "^3.20.2"
45359
48000
  },
45360
48001
  devDependencies: {
45361
48002
  "@types/dockerode": "^3.3.14",
48003
+ "@types/glob": "^8.1.0",
45362
48004
  "@types/node": "^18.11.15",
45363
48005
  "@types/pg": "^8.6.5",
45364
48006
  "@typescript-eslint/eslint-plugin": "^5.46.1",
@@ -45366,7 +48008,7 @@ var package_default = {
45366
48008
  ava: "^5.1.0",
45367
48009
  dockerode: "^3.3.4",
45368
48010
  "drizzle-kit": "^0.16.8",
45369
- "drizzle-orm": "0.19.0-03308d4",
48011
+ "drizzle-orm": "0.21.0-2e66963",
45370
48012
  esbuild: "^0.15.7",
45371
48013
  "esbuild-register": "^3.3.3",
45372
48014
  eslint: "^8.29.0",
@@ -45669,6 +48311,35 @@ var updateV3toV42 = (old) => {
45669
48311
  // src/cli/index.ts
45670
48312
  init_upFolders();
45671
48313
  init_mysqlSchema();
48314
+
48315
+ // src/cli/commands/drop.ts
48316
+ init_source();
48317
+ var import_fs9 = require("fs");
48318
+ var import_hanji3 = __toESM(require_hanji());
48319
+ var import_path7 = require("path");
48320
+ init_views();
48321
+ var dropMigration = async (out) => {
48322
+ const metaFilePath = (0, import_path7.join)(out, "meta", "_journal.json");
48323
+ const journal = JSON.parse(
48324
+ (0, import_fs9.readFileSync)(metaFilePath, "utf-8")
48325
+ );
48326
+ const result = await (0, import_hanji3.render)(new DropMigrationView(journal.entries));
48327
+ if (result.status === "aborted")
48328
+ return;
48329
+ delete journal.entries[journal.entries.indexOf(result.data)];
48330
+ const resultJournal = {
48331
+ ...journal,
48332
+ entries: journal.entries.filter(Boolean)
48333
+ };
48334
+ const sqlFilePath = (0, import_path7.join)(out, `${result.data.tag}.sql`);
48335
+ const snapshotFilePath = (0, import_path7.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
48336
+ (0, import_fs9.rmSync)(sqlFilePath);
48337
+ (0, import_fs9.rmSync)(snapshotFilePath);
48338
+ (0, import_fs9.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
48339
+ console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
48340
+ };
48341
+
48342
+ // src/cli/index.ts
45672
48343
  var printVersions = () => {
45673
48344
  console.log(`${source_default.gray(versions())}
45674
48345
  `);
@@ -45676,13 +48347,13 @@ var printVersions = () => {
45676
48347
  var assertEitherConfigOrOut = (config, out) => {
45677
48348
  if (out)
45678
48349
  return out;
45679
- if (!(0, import_fs9.existsSync)(import_path7.default.join(import_path7.default.resolve(config)))) {
48350
+ if (!(0, import_fs10.existsSync)(import_path8.default.join(import_path8.default.resolve(config)))) {
45680
48351
  console.log(`${config} file does not exist`);
45681
48352
  process.exit(1);
45682
48353
  }
45683
48354
  console.log(`Reading ${config}`);
45684
48355
  const drizzleConfig = JSON.parse(
45685
- import_fs9.default.readFileSync(import_path7.default.join(import_path7.default.resolve(config))).toString()
48356
+ import_fs10.default.readFileSync(import_path8.default.join(import_path8.default.resolve(config))).toString()
45686
48357
  );
45687
48358
  return drizzleConfig.out;
45688
48359
  };
@@ -45694,12 +48365,12 @@ drizzle-orm: v${npmVersion}` : "";
45694
48365
  return versions2;
45695
48366
  };
45696
48367
  var configSchema = objectType({
45697
- schema: stringType(),
48368
+ schema: unionType([stringType(), stringType().array()]),
45698
48369
  out: stringType().default("drizzle"),
45699
48370
  breakpoints: booleanType()
45700
48371
  }).strict();
45701
48372
  var optionsSchema = objectType({
45702
- schema: stringType().optional(),
48373
+ schema: unionType([stringType(), stringType().array()]).optional(),
45703
48374
  out: stringType().optional(),
45704
48375
  config: stringType().optional(),
45705
48376
  breakpoints: booleanType().optional().default(false)
@@ -45757,7 +48428,7 @@ var prepareGenerateConfig = (options) => {
45757
48428
  if (!(schema4 || out)) {
45758
48429
  const path4 = config != null ? config : "drizzle.config.json";
45759
48430
  const drizzleConfig = JSON.parse(
45760
- import_fs9.default.readFileSync(import_path7.default.join(import_path7.default.resolve(path4))).toString()
48431
+ import_fs10.default.readFileSync(import_path8.default.join(import_path8.default.resolve(path4))).toString()
45761
48432
  );
45762
48433
  return drizzleConfig;
45763
48434
  }
@@ -45865,8 +48536,8 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
45865
48536
  }
45866
48537
  const { snapshots, journal } = prepareOutFolder(res.data.out, "pg");
45867
48538
  const { schema: schema4, ts } = await pgIntrospect2(res.data);
45868
- const schemaFile = import_path7.default.join(res.data.out, "schema.ts");
45869
- (0, import_fs9.writeFileSync)(schemaFile, ts);
48539
+ const schemaFile = import_path8.default.join(res.data.out, "schema.ts");
48540
+ (0, import_fs10.writeFileSync)(schemaFile, ts);
45870
48541
  console.log();
45871
48542
  if (snapshots.length === 0) {
45872
48543
  const { sqlStatements, _meta } = await prepareSQL(
@@ -45874,15 +48545,22 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
45874
48545
  squashPgScheme(schema4),
45875
48546
  "pg"
45876
48547
  );
45877
- writeResult(schema4, sqlStatements, 0, journal, _meta, res.data.out, res.data.breakpoints);
48548
+ writeResult(
48549
+ schema4,
48550
+ sqlStatements,
48551
+ journal,
48552
+ _meta,
48553
+ res.data.out,
48554
+ res.data.breakpoints
48555
+ );
45878
48556
  } else {
45879
- (0, import_hanji5.render)(
48557
+ (0, import_hanji6.render)(
45880
48558
  `[${source_default.blue(
45881
48559
  "i"
45882
48560
  )}] No SQL generated, you already have migrations in project`
45883
48561
  );
45884
48562
  }
45885
- (0, import_hanji5.render)(
48563
+ (0, import_hanji6.render)(
45886
48564
  `[${source_default.green(
45887
48565
  "\u2713"
45888
48566
  )}] You schema file is ready \u279C ${source_default.bold.underline.blue(
@@ -45907,8 +48585,8 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
45907
48585
  }
45908
48586
  const { snapshots, journal } = prepareOutFolder(res.data.out, "mysql");
45909
48587
  const { schema: schema4, ts } = await mysqlIntrospect2(res.data);
45910
- const schemaFile = import_path7.default.join(res.data.out, "schema.ts");
45911
- (0, import_fs9.writeFileSync)(schemaFile, ts);
48588
+ const schemaFile = import_path8.default.join(res.data.out, "schema.ts");
48589
+ (0, import_fs10.writeFileSync)(schemaFile, ts);
45912
48590
  console.log();
45913
48591
  if (snapshots.length === 0) {
45914
48592
  const { sqlStatements, _meta } = await prepareSQL(
@@ -45916,15 +48594,22 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
45916
48594
  squashMysqlScheme(schema4),
45917
48595
  "mysql"
45918
48596
  );
45919
- writeResult(schema4, sqlStatements, 0, journal, _meta, res.data.out, res.data.breakpoints);
48597
+ writeResult(
48598
+ schema4,
48599
+ sqlStatements,
48600
+ journal,
48601
+ _meta,
48602
+ res.data.out,
48603
+ res.data.breakpoints
48604
+ );
45920
48605
  } else {
45921
- (0, import_hanji5.render)(
48606
+ (0, import_hanji6.render)(
45922
48607
  `[${source_default.blue(
45923
48608
  "i"
45924
48609
  )}] No SQL generated, you already have migrations in project`
45925
48610
  );
45926
48611
  }
45927
- (0, import_hanji5.render)(
48612
+ (0, import_hanji6.render)(
45928
48613
  `[${source_default.green(
45929
48614
  "\u2713"
45930
48615
  )}] You schema file is ready \u279C ${source_default.bold.underline.blue(
@@ -45933,6 +48618,18 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
45933
48618
  );
45934
48619
  process.exit(0);
45935
48620
  });
48621
+ var dropCommand = new Command("drop").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.json]`).action((options) => {
48622
+ printVersions();
48623
+ assertOrmCoreVersion();
48624
+ const params = checkSchema.parse(options);
48625
+ const out = assertEitherConfigOrOut(params.config, params.out);
48626
+ if (!out) {
48627
+ console.log(error(`'out' folder param must be set`));
48628
+ process.exit(0);
48629
+ }
48630
+ assertV1OutFolder(out, "{dialect}");
48631
+ dropMigration(out);
48632
+ });
45936
48633
  program.version(versions(), "--version, -v");
45937
48634
  program.addCommand(generatePgCommand);
45938
48635
  program.addCommand(generateMysqlCommand);
@@ -45944,6 +48641,7 @@ program.addCommand(upMysqlCommand);
45944
48641
  program.addCommand(upSqliteCommand);
45945
48642
  program.addCommand(introspectPgCommand);
45946
48643
  program.addCommand(introspectMySqlCommand);
48644
+ program.addCommand(dropCommand);
45947
48645
  program.parse();
45948
48646
  // Annotate the CommonJS export names for ESM import in node:
45949
48647
  0 && (module.exports = {