@h3ravel/console 11.0.7 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/bin/fire.cjs +2 -0
  2. package/bin/fire.js +2 -0
  3. package/dist/Utils-CpiQZ3n9.cjs +122 -0
  4. package/dist/Utils-CpiQZ3n9.cjs.map +1 -0
  5. package/dist/Utils-Dvclc4Pc.js +73 -0
  6. package/dist/Utils-Dvclc4Pc.js.map +1 -0
  7. package/dist/Utils-cBgwEyTl.d.ts +20 -0
  8. package/dist/Utils-rIdzILgO.d.cts +20 -0
  9. package/dist/Utils.cjs +3 -217
  10. package/dist/Utils.d.cts +2 -0
  11. package/dist/Utils.d.ts +2 -0
  12. package/dist/Utils.js +3 -9
  13. package/dist/index.cjs +790 -949
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.cts +173 -295
  16. package/dist/index.d.ts +173 -295
  17. package/dist/index.js +789 -44
  18. package/dist/index.js.map +1 -0
  19. package/package.json +35 -23
  20. package/bin/chunk-6Z5DP356.js +0 -1
  21. package/bin/lexer-DQCqS3nf-XQPNMZG6.js +0 -4
  22. package/bin/run.cjs +0 -26
  23. package/bin/run.js +0 -26
  24. package/dist/Commands/Command.cjs +0 -104
  25. package/dist/Commands/Command.js +0 -7
  26. package/dist/Commands/MakeCommand.cjs +0 -433
  27. package/dist/Commands/MakeCommand.js +0 -9
  28. package/dist/Commands/MigrateCommand.cjs +0 -200
  29. package/dist/Commands/MigrateCommand.js +0 -8
  30. package/dist/Commands/ServeCommand.cjs +0 -159
  31. package/dist/Commands/ServeCommand.js +0 -8
  32. package/dist/Contracts/ICommand.cjs +0 -18
  33. package/dist/Contracts/ICommand.js +0 -1
  34. package/dist/IO/app.cjs +0 -946
  35. package/dist/IO/app.js +0 -17
  36. package/dist/IO/providers.cjs +0 -930
  37. package/dist/IO/providers.js +0 -16
  38. package/dist/Kernel.cjs +0 -890
  39. package/dist/Kernel.js +0 -14
  40. package/dist/Musket.cjs +0 -835
  41. package/dist/Musket.js +0 -13
  42. package/dist/Providers/ConsoleServiceProvider.cjs +0 -912
  43. package/dist/Providers/ConsoleServiceProvider.js +0 -15
  44. package/dist/Signature.cjs +0 -172
  45. package/dist/Signature.js +0 -7
  46. package/dist/chunk-23QH5R54.js +0 -27
  47. package/dist/chunk-2O2AYFAG.js +0 -63
  48. package/dist/chunk-3ASEWMRX.js +0 -37
  49. package/dist/chunk-3FVPHQCH.js +0 -151
  50. package/dist/chunk-3RX6CLNR.js +0 -32
  51. package/dist/chunk-3VCNSA6P.js +0 -14
  52. package/dist/chunk-3WHUADTN.js +0 -6
  53. package/dist/chunk-6OCHCPBP.js +0 -36
  54. package/dist/chunk-6OIH6FS4.js +0 -32
  55. package/dist/chunk-7EWRZPTX.js +0 -63
  56. package/dist/chunk-7PUQ5ZIN.js +0 -6
  57. package/dist/chunk-A5AONVOH.js +0 -6
  58. package/dist/chunk-ADIVRUAJ.js +0 -27
  59. package/dist/chunk-CCEWV2BR.js +0 -39
  60. package/dist/chunk-CTQ6DUT2.js +0 -8
  61. package/dist/chunk-DXQTBFGG.js +0 -31
  62. package/dist/chunk-E4SSLXFT.js +0 -63
  63. package/dist/chunk-E5XIGIEX.js +0 -14
  64. package/dist/chunk-EIOQKTRM.js +0 -104
  65. package/dist/chunk-FOSDCKCR.js +0 -106
  66. package/dist/chunk-G4OE26TZ.js +0 -33
  67. package/dist/chunk-GVGO5OAK.js +0 -8
  68. package/dist/chunk-GXRCTWKL.js +0 -16
  69. package/dist/chunk-HVKW7JK4.js +0 -8
  70. package/dist/chunk-IGEFNODG.js +0 -22
  71. package/dist/chunk-JXL4VJHZ.js +0 -36
  72. package/dist/chunk-K3GOQSS3.js +0 -6
  73. package/dist/chunk-KCJKQP37.js +0 -133
  74. package/dist/chunk-KMIFCLXG.js +0 -16
  75. package/dist/chunk-KZA3MC77.js +0 -151
  76. package/dist/chunk-LLL3V7LB.js +0 -6
  77. package/dist/chunk-LQ6DL2HS.js +0 -68
  78. package/dist/chunk-M4ZRDJJ2.js +0 -68
  79. package/dist/chunk-MAQAT3PU.js +0 -32
  80. package/dist/chunk-MPXPSSLJ.js +0 -133
  81. package/dist/chunk-NADN2PHB.js +0 -0
  82. package/dist/chunk-NFRXMBRP.js +0 -24
  83. package/dist/chunk-NVPKTRMT.js +0 -7
  84. package/dist/chunk-O45AB4MX.js +0 -83
  85. package/dist/chunk-ORPRWIQ2.js +0 -33
  86. package/dist/chunk-P7M5PEDY.js +0 -18
  87. package/dist/chunk-PBNCVQZC.js +0 -6
  88. package/dist/chunk-PMV4TMFS.js +0 -151
  89. package/dist/chunk-POF4JGTX.js +0 -186
  90. package/dist/chunk-PYSJMSNM.js +0 -27
  91. package/dist/chunk-Q3OMG6YH.js +0 -186
  92. package/dist/chunk-QCNBVSFO.js +0 -68
  93. package/dist/chunk-QMEO4OUR.js +0 -151
  94. package/dist/chunk-QSQNELZQ.js +0 -83
  95. package/dist/chunk-RRP7K5LI.js +0 -36
  96. package/dist/chunk-SHUYVCID.js +0 -6
  97. package/dist/chunk-SP4JKAUC.js +0 -63
  98. package/dist/chunk-T6OOKENF.js +0 -6
  99. package/dist/chunk-TBDROT3I.js +0 -6356
  100. package/dist/chunk-TH2RWMWA.js +0 -133
  101. package/dist/chunk-TJZCDDEV.js +0 -36
  102. package/dist/chunk-TN5SV7LF.js +0 -133
  103. package/dist/chunk-U6TOLKGJ.js +0 -22
  104. package/dist/chunk-UCOXL3OM.js +0 -0
  105. package/dist/chunk-URLTFJET.js +0 -68
  106. package/dist/chunk-UWCTG2LX.js +0 -24
  107. package/dist/chunk-WO2BXMBQ.js +0 -6
  108. package/dist/chunk-XAWZUZVP.js +0 -32
  109. package/dist/chunk-XCOSZXAE.js +0 -133
  110. package/dist/chunk-XD2Q7LWE.js +0 -24
  111. package/dist/chunk-XSL373TG.js +0 -36
  112. package/dist/chunk-XUYTJO6X.js +0 -104
  113. package/dist/chunk-YAYU7VOK.js +0 -8
  114. package/dist/chunk-YRUCICBV.js +0 -24
  115. package/dist/chunk-Z5XE72Q5.js +0 -68
  116. package/dist/chunk-ZTIO25VB.js +0 -8
  117. package/dist/lexer-DQCqS3nf-6W2BHF4T.js +0 -68
  118. package/dist/run.cjs +0 -943
  119. package/dist/run.js +0 -14
package/bin/fire.cjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`tsx/esm`);let c=require(`@h3ravel/core`);c=s(c);let l=require(`@h3ravel/console`);l=s(l);let u=require(`node:fs/promises`);u=s(u);let d=require(`node:path`);d=s(d);let f=require(`@h3ravel/http`);f=s(f);let p=require(`@h3ravel/router`);p=s(p);let m=require(`@h3ravel/database`);m=s(m);let h=require(`@h3ravel/cache`);h=s(h);let g=require(`@h3ravel/queue`);g=s(g);let _=require(`@h3ravel/mail`);_=s(_);let v=require(`@h3ravel/config`);v=s(v);var y=[f.HttpServiceProvider,v.ConfigServiceProvider,p.RouteServiceProvider,p.AssetsServiceProvider,m.DatabaseServiceProvider,h.CacheServiceProvider,g.QueueServiceProvider,_.MailServiceProvider],b=class{async fire(){let e=new c.Application(process.cwd()),t=app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let e of(0,u.glob)(t)){let t=d.default.basename(e).replace(`.js`,``);try{y.push((await import(e))[t])}catch{}}y.push(l.ConsoleServiceProvider),e.registerProviders(y),await e.registerConfiguredProviders(),await e.boot()}};new b().fire();
package/bin/fire.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import"tsx/esm";import{Application as e}from"@h3ravel/core";import{ConsoleServiceProvider as t}from"@h3ravel/console";import{glob as n}from"node:fs/promises";import r from"node:path";import{HttpServiceProvider as i}from"@h3ravel/http";import{AssetsServiceProvider as a,RouteServiceProvider as o}from"@h3ravel/router";import{DatabaseServiceProvider as s}from"@h3ravel/database";import{CacheServiceProvider as c}from"@h3ravel/cache";import{QueueServiceProvider as l}from"@h3ravel/queue";import{MailServiceProvider as u}from"@h3ravel/mail";import{ConfigServiceProvider as d}from"@h3ravel/config";var f=[i,d,o,a,s,c,l,u];new class{async fire(){let i=new e(process.cwd()),a=(app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`));for await(let e of n(a)){let t=(r.basename(e).replace(`.js`,``));try{f.push((await import(e))[t])}catch{}}f.push(t),i.registerProviders(f),await i.registerConfiguredProviders(),await i.boot()}}().fire();export{};
@@ -0,0 +1,122 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ let fs_promises = require("fs/promises");
25
+ fs_promises = __toESM(fs_promises);
26
+ let path = require("path");
27
+ path = __toESM(path);
28
+ let fs = require("fs");
29
+ fs = __toESM(fs);
30
+
31
+ //#region ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
32
+ function sync_default(start, callback) {
33
+ let dir = (0, path.resolve)(".", start);
34
+ let tmp;
35
+ if (!(0, fs.statSync)(dir).isDirectory()) dir = (0, path.dirname)(dir);
36
+ while (true) {
37
+ tmp = callback(dir, (0, fs.readdirSync)(dir));
38
+ if (tmp) return (0, path.resolve)(dir, tmp);
39
+ dir = (0, path.dirname)(tmp = dir);
40
+ if (tmp === dir) break;
41
+ }
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/Utils.ts
46
+ var Utils = class {
47
+ static findModulePkg(moduleId, cwd) {
48
+ const parts = moduleId.replace(/\\/g, "/").split("/");
49
+ let packageName = "";
50
+ if (parts.length > 0 && parts[0][0] === "@") packageName += parts.shift() + "/";
51
+ packageName += parts.shift();
52
+ const packageJson = path.default.join(cwd ?? process.cwd(), "node_modules", packageName);
53
+ const resolved = this.findUpConfig(packageJson, "package", ["json"]);
54
+ if (!resolved) return;
55
+ return path.default.join(path.default.dirname(resolved), parts.join("/"));
56
+ }
57
+ /**
58
+ * Check if file exists
59
+ *
60
+ * @param path
61
+ * @returns
62
+ */
63
+ static async fileExists(path$2) {
64
+ try {
65
+ await (0, fs_promises.access)(path$2);
66
+ return true;
67
+ } catch {
68
+ return false;
69
+ }
70
+ }
71
+ static findUpConfig(cwd, name, extensions) {
72
+ return sync_default(cwd, (_dir, names) => {
73
+ for (const ext of extensions) {
74
+ const filename = `${name}.${ext}`;
75
+ if (names.includes(filename)) return filename;
76
+ }
77
+ return false;
78
+ });
79
+ }
80
+ };
81
+ var TableGuesser = class TableGuesser {
82
+ static CREATE_PATTERNS = [/^create_(\w+)_table$/, /^create_(\w+)$/];
83
+ static CHANGE_PATTERNS = [/.+_(to|from|in)_(\w+)_table$/, /.+_(to|from|in)_(\w+)$/];
84
+ static guess(migration) {
85
+ for (const pattern of TableGuesser.CREATE_PATTERNS) {
86
+ const matches = migration.match(pattern);
87
+ if (matches) return [matches[1], true];
88
+ }
89
+ for (const pattern of TableGuesser.CHANGE_PATTERNS) {
90
+ const matches = migration.match(pattern);
91
+ if (matches) return [matches[2], false];
92
+ }
93
+ return [];
94
+ }
95
+ };
96
+
97
+ //#endregion
98
+ Object.defineProperty(exports, 'TableGuesser', {
99
+ enumerable: true,
100
+ get: function () {
101
+ return TableGuesser;
102
+ }
103
+ });
104
+ Object.defineProperty(exports, 'Utils', {
105
+ enumerable: true,
106
+ get: function () {
107
+ return Utils;
108
+ }
109
+ });
110
+ Object.defineProperty(exports, '__toESM', {
111
+ enumerable: true,
112
+ get: function () {
113
+ return __toESM;
114
+ }
115
+ });
116
+ Object.defineProperty(exports, 'sync_default', {
117
+ enumerable: true,
118
+ get: function () {
119
+ return sync_default;
120
+ }
121
+ });
122
+ //# sourceMappingURL=Utils-CpiQZ3n9.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils-CpiQZ3n9.cjs","names":["path","escalade"],"sources":["../../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs","../src/Utils.ts"],"sourcesContent":["import { dirname, resolve } from 'path';\nimport { readdirSync, statSync } from 'fs';\n\nexport default function (start, callback) {\n\tlet dir = resolve('.', start);\n\tlet tmp, stats = statSync(dir);\n\n\tif (!stats.isDirectory()) {\n\t\tdir = dirname(dir);\n\t}\n\n\twhile (true) {\n\t\ttmp = callback(dir, readdirSync(dir));\n\t\tif (tmp) return resolve(dir, tmp);\n\t\tdir = dirname(tmp = dir);\n\t\tif (tmp === dir) break;\n\t}\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\n\nexport class Utils {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.findUpConfig(packageJson, 'package', ['json'])\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n static findUpConfig (cwd: string, name: string, extensions: string[]) {\n return escalade(cwd, (_dir, names) => {\n for (const ext of extensions) {\n const filename = `${name}.${ext}`\n if (names.includes(filename)) {\n return filename\n }\n }\n return false\n })\n }\n}\n\nclass TableGuesser {\n static CREATE_PATTERNS = [\n /^create_(\\w+)_table$/,\n /^create_(\\w+)$/\n ]\n static CHANGE_PATTERNS = [\n /.+_(to|from|in)_(\\w+)_table$/,\n /.+_(to|from|in)_(\\w+)$/\n ]\n static guess (migration: string) {\n for (const pattern of TableGuesser.CREATE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[1], true]\n }\n }\n for (const pattern of TableGuesser.CHANGE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[2], false]\n }\n }\n return []\n }\n}\n\nexport { TableGuesser }\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAyB,OAAO,UAAU;CACzC,IAAI,wBAAc,KAAK,MAAM;CAC7B,IAAI;AAEJ,KAAI,kBAFsB,IAAI,CAEnB,aAAa,CACvB,yBAAc,IAAI;AAGnB,QAAO,MAAM;AACZ,QAAM,SAAS,yBAAiB,IAAI,CAAC;AACrC,MAAI,IAAK,0BAAe,KAAK,IAAI;AACjC,0BAAc,MAAM,IAAI;AACxB,MAAI,QAAQ,IAAK;;;;;;ACXnB,IAAa,QAAb,MAAmB;CACjB,OAAO,cAAe,UAAkB,KAAc;EACpD,MAAM,QAAQ,SAAS,QAAQ,OAAO,IAAI,CAAC,MAAM,IAAI;EAErD,IAAI,cAAc;AAElB,MAAI,MAAM,SAAS,KAAK,MAAM,GAAG,OAAO,IACtC,gBAAe,MAAM,OAAO,GAAG;AAEjC,iBAAe,MAAM,OAAO;EAE5B,MAAM,cAAc,aAAK,KAAK,OAAO,QAAQ,KAAK,EAAE,gBAAgB,YAAY;EAEhF,MAAM,WAAW,KAAK,aAAa,aAAa,WAAW,CAAC,OAAO,CAAC;AAEpE,MAAI,CAAC,SACH;AAGF,SAAO,aAAK,KAAK,aAAK,QAAQ,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;;;;;;;;CAS3D,aAAa,WAAY,QAAgC;AACvD,MAAI;AACF,iCAAaA,OAAK;AAClB,UAAO;UACD;AACN,UAAO;;;CAIX,OAAO,aAAc,KAAa,MAAc,YAAsB;AACpE,SAAOC,aAAS,MAAM,MAAM,UAAU;AACpC,QAAK,MAAM,OAAO,YAAY;IAC5B,MAAM,WAAW,GAAG,KAAK,GAAG;AAC5B,QAAI,MAAM,SAAS,SAAS,CAC1B,QAAO;;AAGX,UAAO;IACP;;;AAIN,IAAM,eAAN,MAAM,aAAa;CACjB,OAAO,kBAAkB,CACvB,wBACA,iBACD;CACD,OAAO,kBAAkB,CACvB,gCACA,yBACD;CACD,OAAO,MAAO,WAAmB;AAC/B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,KAAK;;AAG7B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,MAAM;;AAG9B,SAAO,EAAE"}
@@ -0,0 +1,73 @@
1
+ import { access } from "fs/promises";
2
+ import path, { dirname, resolve } from "path";
3
+ import { readdirSync, statSync } from "fs";
4
+
5
+ //#region ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
6
+ function sync_default(start, callback) {
7
+ let dir = resolve(".", start);
8
+ let tmp;
9
+ if (!statSync(dir).isDirectory()) dir = dirname(dir);
10
+ while (true) {
11
+ tmp = callback(dir, readdirSync(dir));
12
+ if (tmp) return resolve(dir, tmp);
13
+ dir = dirname(tmp = dir);
14
+ if (tmp === dir) break;
15
+ }
16
+ }
17
+
18
+ //#endregion
19
+ //#region src/Utils.ts
20
+ var Utils = class {
21
+ static findModulePkg(moduleId, cwd) {
22
+ const parts = moduleId.replace(/\\/g, "/").split("/");
23
+ let packageName = "";
24
+ if (parts.length > 0 && parts[0][0] === "@") packageName += parts.shift() + "/";
25
+ packageName += parts.shift();
26
+ const packageJson = path.join(cwd ?? process.cwd(), "node_modules", packageName);
27
+ const resolved = this.findUpConfig(packageJson, "package", ["json"]);
28
+ if (!resolved) return;
29
+ return path.join(path.dirname(resolved), parts.join("/"));
30
+ }
31
+ /**
32
+ * Check if file exists
33
+ *
34
+ * @param path
35
+ * @returns
36
+ */
37
+ static async fileExists(path$1) {
38
+ try {
39
+ await access(path$1);
40
+ return true;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+ static findUpConfig(cwd, name, extensions) {
46
+ return sync_default(cwd, (_dir, names) => {
47
+ for (const ext of extensions) {
48
+ const filename = `${name}.${ext}`;
49
+ if (names.includes(filename)) return filename;
50
+ }
51
+ return false;
52
+ });
53
+ }
54
+ };
55
+ var TableGuesser = class TableGuesser {
56
+ static CREATE_PATTERNS = [/^create_(\w+)_table$/, /^create_(\w+)$/];
57
+ static CHANGE_PATTERNS = [/.+_(to|from|in)_(\w+)_table$/, /.+_(to|from|in)_(\w+)$/];
58
+ static guess(migration) {
59
+ for (const pattern of TableGuesser.CREATE_PATTERNS) {
60
+ const matches = migration.match(pattern);
61
+ if (matches) return [matches[1], true];
62
+ }
63
+ for (const pattern of TableGuesser.CHANGE_PATTERNS) {
64
+ const matches = migration.match(pattern);
65
+ if (matches) return [matches[2], false];
66
+ }
67
+ return [];
68
+ }
69
+ };
70
+
71
+ //#endregion
72
+ export { TableGuesser, Utils, sync_default };
73
+ //# sourceMappingURL=Utils-Dvclc4Pc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils-Dvclc4Pc.js","names":["path","escalade"],"sources":["../../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs","../src/Utils.ts"],"sourcesContent":["import { dirname, resolve } from 'path';\nimport { readdirSync, statSync } from 'fs';\n\nexport default function (start, callback) {\n\tlet dir = resolve('.', start);\n\tlet tmp, stats = statSync(dir);\n\n\tif (!stats.isDirectory()) {\n\t\tdir = dirname(dir);\n\t}\n\n\twhile (true) {\n\t\ttmp = callback(dir, readdirSync(dir));\n\t\tif (tmp) return resolve(dir, tmp);\n\t\tdir = dirname(tmp = dir);\n\t\tif (tmp === dir) break;\n\t}\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\n\nexport class Utils {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.findUpConfig(packageJson, 'package', ['json'])\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n static findUpConfig (cwd: string, name: string, extensions: string[]) {\n return escalade(cwd, (_dir, names) => {\n for (const ext of extensions) {\n const filename = `${name}.${ext}`\n if (names.includes(filename)) {\n return filename\n }\n }\n return false\n })\n }\n}\n\nclass TableGuesser {\n static CREATE_PATTERNS = [\n /^create_(\\w+)_table$/,\n /^create_(\\w+)$/\n ]\n static CHANGE_PATTERNS = [\n /.+_(to|from|in)_(\\w+)_table$/,\n /.+_(to|from|in)_(\\w+)$/\n ]\n static guess (migration: string) {\n for (const pattern of TableGuesser.CREATE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[1], true]\n }\n }\n for (const pattern of TableGuesser.CHANGE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[2], false]\n }\n }\n return []\n }\n}\n\nexport { TableGuesser }\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAGA,sBAAyB,OAAO,UAAU;CACzC,IAAI,MAAM,QAAQ,KAAK,MAAM;CAC7B,IAAI;AAEJ,KAAI,CAFa,SAAS,IAAI,CAEnB,aAAa,CACvB,OAAM,QAAQ,IAAI;AAGnB,QAAO,MAAM;AACZ,QAAM,SAAS,KAAK,YAAY,IAAI,CAAC;AACrC,MAAI,IAAK,QAAO,QAAQ,KAAK,IAAI;AACjC,QAAM,QAAQ,MAAM,IAAI;AACxB,MAAI,QAAQ,IAAK;;;;;;ACXnB,IAAa,QAAb,MAAmB;CACjB,OAAO,cAAe,UAAkB,KAAc;EACpD,MAAM,QAAQ,SAAS,QAAQ,OAAO,IAAI,CAAC,MAAM,IAAI;EAErD,IAAI,cAAc;AAElB,MAAI,MAAM,SAAS,KAAK,MAAM,GAAG,OAAO,IACtC,gBAAe,MAAM,OAAO,GAAG;AAEjC,iBAAe,MAAM,OAAO;EAE5B,MAAM,cAAc,KAAK,KAAK,OAAO,QAAQ,KAAK,EAAE,gBAAgB,YAAY;EAEhF,MAAM,WAAW,KAAK,aAAa,aAAa,WAAW,CAAC,OAAO,CAAC;AAEpE,MAAI,CAAC,SACH;AAGF,SAAO,KAAK,KAAK,KAAK,QAAQ,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;;;;;;;;CAS3D,aAAa,WAAY,QAAgC;AACvD,MAAI;AACF,SAAM,OAAOA,OAAK;AAClB,UAAO;UACD;AACN,UAAO;;;CAIX,OAAO,aAAc,KAAa,MAAc,YAAsB;AACpE,SAAOC,aAAS,MAAM,MAAM,UAAU;AACpC,QAAK,MAAM,OAAO,YAAY;IAC5B,MAAM,WAAW,GAAG,KAAK,GAAG;AAC5B,QAAI,MAAM,SAAS,SAAS,CAC1B,QAAO;;AAGX,UAAO;IACP;;;AAIN,IAAM,eAAN,MAAM,aAAa;CACjB,OAAO,kBAAkB,CACvB,wBACA,iBACD;CACD,OAAO,kBAAkB,CACvB,gCACA,yBACD;CACD,OAAO,MAAO,WAAmB;AAC/B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,KAAK;;AAG7B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,MAAM;;AAG9B,SAAO,EAAE"}
@@ -0,0 +1,20 @@
1
+ //#region src/Utils.d.ts
2
+ declare class Utils {
3
+ static findModulePkg(moduleId: string, cwd?: string): string | undefined;
4
+ /**
5
+ * Check if file exists
6
+ *
7
+ * @param path
8
+ * @returns
9
+ */
10
+ static fileExists(path: string): Promise<boolean>;
11
+ static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
12
+ }
13
+ declare class TableGuesser {
14
+ static CREATE_PATTERNS: RegExp[];
15
+ static CHANGE_PATTERNS: RegExp[];
16
+ static guess(migration: string): (string | boolean)[];
17
+ }
18
+ //#endregion
19
+ export { TableGuesser, Utils };
20
+ //# sourceMappingURL=Utils-cBgwEyTl.d.ts.map
@@ -0,0 +1,20 @@
1
+ //#region src/Utils.d.ts
2
+ declare class Utils {
3
+ static findModulePkg(moduleId: string, cwd?: string): string | undefined;
4
+ /**
5
+ * Check if file exists
6
+ *
7
+ * @param path
8
+ * @returns
9
+ */
10
+ static fileExists(path: string): Promise<boolean>;
11
+ static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
12
+ }
13
+ declare class TableGuesser {
14
+ static CREATE_PATTERNS: RegExp[];
15
+ static CHANGE_PATTERNS: RegExp[];
16
+ static guess(migration: string): (string | boolean)[];
17
+ }
18
+ //#endregion
19
+ export { TableGuesser, Utils };
20
+ //# sourceMappingURL=Utils-rIdzILgO.d.cts.map
package/dist/Utils.cjs CHANGED
@@ -1,218 +1,4 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ const require_Utils = require('./Utils-CpiQZ3n9.cjs');
30
2
 
31
- // src/Utils.ts
32
- var Utils_exports = {};
33
- __export(Utils_exports, {
34
- TableGuesser: () => TableGuesser,
35
- Utils: () => Utils
36
- });
37
- module.exports = __toCommonJS(Utils_exports);
38
- var import_promises = require("fs/promises");
39
- var import_chalk = __toESM(require("chalk"), 1);
40
-
41
- // ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
42
- var import_path = require("path");
43
- var import_fs = require("fs");
44
- function sync_default(start, callback) {
45
- let dir = (0, import_path.resolve)(".", start);
46
- let tmp, stats = (0, import_fs.statSync)(dir);
47
- if (!stats.isDirectory()) {
48
- dir = (0, import_path.dirname)(dir);
49
- }
50
- while (true) {
51
- tmp = callback(dir, (0, import_fs.readdirSync)(dir));
52
- if (tmp) return (0, import_path.resolve)(dir, tmp);
53
- dir = (0, import_path.dirname)(tmp = dir);
54
- if (tmp === dir) break;
55
- }
56
- }
57
- __name(sync_default, "default");
58
-
59
- // src/Utils.ts
60
- var import_path2 = __toESM(require("path"), 1);
61
- var join = import_path2.default.join;
62
- var Utils = class {
63
- static {
64
- __name(this, "Utils");
65
- }
66
- /**
67
- * Wraps text with chalk
68
- *
69
- * @param txt
70
- * @param color
71
- * @returns
72
- */
73
- static textFormat(txt, color) {
74
- return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
75
- }
76
- /**
77
- * Ouput formater object
78
- *
79
- * @returns
80
- */
81
- static output() {
82
- return {
83
- success: /* @__PURE__ */ __name((msg, exit = false) => {
84
- console.log(import_chalk.default.green("\u2713"), this.textFormat(msg, import_chalk.default.bgGreen), "\n");
85
- if (exit) process.exit(0);
86
- }, "success"),
87
- info: /* @__PURE__ */ __name((msg, exit = false) => {
88
- console.log(import_chalk.default.blue("\u2139"), this.textFormat(msg, import_chalk.default.bgBlue), "\n");
89
- if (exit) process.exit(0);
90
- }, "info"),
91
- error: /* @__PURE__ */ __name((msg, exit = true) => {
92
- if (msg instanceof Error) {
93
- if (msg.message) {
94
- console.error(import_chalk.default.red("\u2716"), this.textFormat("ERROR:" + msg.message, import_chalk.default.bgRed));
95
- }
96
- console.error(import_chalk.default.red(`${msg.detail ? `${msg.detail}
97
- ` : ""}${msg.stack}`), "\n");
98
- } else {
99
- console.error(import_chalk.default.red("\u2716"), this.textFormat(msg, import_chalk.default.bgRed), "\n");
100
- }
101
- if (exit) process.exit(1);
102
- }, "error"),
103
- split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
104
- status ??= "info";
105
- const color = {
106
- success: import_chalk.default.bgGreen,
107
- info: import_chalk.default.bgBlue,
108
- error: import_chalk.default.bgRed
109
- };
110
- const regex = /\x1b\[\d+m/g;
111
- const width = Math.min(process.stdout.columns, 100);
112
- const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
113
- console.log(this.textFormat(name, color[status]), import_chalk.default.gray(".".repeat(dots)), value);
114
- if (exit) process.exit(0);
115
- }, "split"),
116
- quiet: /* @__PURE__ */ __name(() => {
117
- process.exit(0);
118
- }, "quiet")
119
- };
120
- }
121
- static findModulePkg(moduleId, cwd) {
122
- const parts = moduleId.replace(/\\/g, "/").split("/");
123
- let packageName = "";
124
- if (parts.length > 0 && parts[0][0] === "@") {
125
- packageName += parts.shift() + "/";
126
- }
127
- packageName += parts.shift();
128
- const packageJson = import_path2.default.join(cwd ?? process.cwd(), "node_modules", packageName);
129
- const resolved = this.findUpConfig(packageJson, "package", [
130
- "json"
131
- ]);
132
- if (!resolved) {
133
- return;
134
- }
135
- return import_path2.default.join(import_path2.default.dirname(resolved), parts.join("/"));
136
- }
137
- static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
138
- if (path2) {
139
- return [
140
- join(cwd, path2)
141
- ];
142
- }
143
- return [
144
- ...migrator.getPaths(),
145
- join(cwd, defaultPath)
146
- ];
147
- }
148
- static twoColumnDetail(name, value) {
149
- const regex = /\x1b\[\d+m/g;
150
- const width = Math.min(process.stdout.columns, 100);
151
- const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
152
- return console.log(name, import_chalk.default.gray(".".repeat(dots)), value);
153
- }
154
- /**
155
- * Check if file exists
156
- *
157
- * @param path
158
- * @returns
159
- */
160
- static async fileExists(path2) {
161
- try {
162
- await (0, import_promises.access)(path2);
163
- return true;
164
- } catch {
165
- return false;
166
- }
167
- }
168
- static findUpConfig(cwd, name, extensions) {
169
- return sync_default(cwd, (_dir, names) => {
170
- for (const ext of extensions) {
171
- const filename = `${name}.${ext}`;
172
- if (names.includes(filename)) {
173
- return filename;
174
- }
175
- }
176
- return false;
177
- });
178
- }
179
- };
180
- var TableGuesser = class TableGuesser2 {
181
- static {
182
- __name(this, "TableGuesser");
183
- }
184
- static CREATE_PATTERNS = [
185
- /^create_(\w+)_table$/,
186
- /^create_(\w+)$/
187
- ];
188
- static CHANGE_PATTERNS = [
189
- /.+_(to|from|in)_(\w+)_table$/,
190
- /.+_(to|from|in)_(\w+)$/
191
- ];
192
- static guess(migration) {
193
- for (const pattern of TableGuesser2.CREATE_PATTERNS) {
194
- const matches = migration.match(pattern);
195
- if (matches) {
196
- return [
197
- matches[1],
198
- true
199
- ];
200
- }
201
- }
202
- for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
203
- const matches = migration.match(pattern);
204
- if (matches) {
205
- return [
206
- matches[2],
207
- false
208
- ];
209
- }
210
- }
211
- return [];
212
- }
213
- };
214
- // Annotate the CommonJS export names for ESM import in node:
215
- 0 && (module.exports = {
216
- TableGuesser,
217
- Utils
218
- });
3
+ exports.TableGuesser = require_Utils.TableGuesser;
4
+ exports.Utils = require_Utils.Utils;
@@ -0,0 +1,2 @@
1
+ import { TableGuesser, Utils } from "./Utils-rIdzILgO.cjs";
2
+ export { TableGuesser, Utils };
@@ -0,0 +1,2 @@
1
+ import { TableGuesser, Utils } from "./Utils-cBgwEyTl.js";
2
+ export { TableGuesser, Utils };
package/dist/Utils.js CHANGED
@@ -1,9 +1,3 @@
1
- import {
2
- TableGuesser,
3
- Utils
4
- } from "./chunk-POF4JGTX.js";
5
- import "./chunk-SHUYVCID.js";
6
- export {
7
- TableGuesser,
8
- Utils
9
- };
1
+ import { TableGuesser, Utils } from "./Utils-Dvclc4Pc.js";
2
+
3
+ export { TableGuesser, Utils };