@omer-x/next-openapi-json-generator 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -47,6 +47,8 @@ const Page = async () => {
47
47
  UserDTO,
48
48
  NewUserDTO,
49
49
  UserPatchDTO,
50
+ }, {
51
+ // options
50
52
  });
51
53
  return <ReactSwagger spec={spec} />;
52
54
  };
@@ -58,9 +60,18 @@ export default Page;
58
60
 
59
61
  The `generateOpenApiSpec` function takes an object with the following properties:
60
62
 
61
- | Property | Type | Description |
62
- | ------------ | ------------------------------------------- | ---------------------------------------------------------------- |
63
- | models | Record<string, [ZodType](https://zod.dev)> | An object where keys are model names and values are Zod schemas. |
63
+ | Property | Type | Description |
64
+ | -------- | ------------------------------------------ | ---------------------------------------------------------------------------------- |
65
+ | models | Record<string, [ZodType](https://zod.dev)> | An object where keys are model names and values are Zod schemas |
66
+ | options | Object | `(Optional)` An object to customize the functionality of the generator (see below) |
67
+
68
+ #### Options
69
+
70
+ | Property | Type | Description |
71
+ | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
72
+ | include | string[] | `(Optional)` An array of strings which specifies the routes will be included to the JSON output |
73
+ | exclude | string[] | `(Optional)` An array of strings which specifies the routes will be excluded from the JSON output |
74
+ | routeDefinerName | string | `(Optional)` Name of the function that was exported from the [`Next OpenAPI Route Handler`](https://www.npmjs.com/package/@omer-x/next-openapi-route-handler) (Default: `defineRoute`) |
64
75
 
65
76
  ### Result
66
77
 
@@ -1,5 +1,5 @@
1
1
  import type { OperationObject } from "@omer-x/openapi-types/operation";
2
2
  export declare function findAppFolderPath(): Promise<string | null>;
3
- export declare function getRouteExports(routePath: string, schemas: Record<string, unknown>): Promise<Record<string, {
3
+ export declare function getRouteExports(routePath: string, routeDefinerName: string, schemas: Record<string, unknown>): Promise<Record<string, {
4
4
  apiData?: OperationObject;
5
5
  } | undefined>>;
@@ -1,4 +1,4 @@
1
- export declare function verifyOptions(include?: string[], exclude?: string[]): {
1
+ export declare function verifyOptions(include: string[], exclude: string[]): {
2
2
  include: string[];
3
3
  exclude: string[];
4
4
  };
@@ -1 +1 @@
1
- export declare function transpile(rawCode: string): string;
1
+ export declare function transpile(rawCode: string, routeDefinerName: string): string;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { ZodType } from "zod";
3
3
  type GeneratorOptions = {
4
4
  include?: string[];
5
5
  exclude?: string[];
6
+ routeDefinerName?: string;
6
7
  };
7
- export default function generateOpenApiSpec(schemas: Record<string, ZodType>, options?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
8
+ export default function generateOpenApiSpec(schemas: Record<string, ZodType>, { include: includeOption, exclude: excludeOption, routeDefinerName, }?: GeneratorOptions): Promise<Omit<OpenApiDocument, "components"> & Required<Pick<OpenApiDocument, "components">>>;
8
9
  export {};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (()=>{var __webpack_modules__={505:t=>{"use strict";function e(t,e,i){t instanceof RegExp&&(t=s(t,i)),e instanceof RegExp&&(e=s(e,i));var n=r(t,e,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+t.length,n[1]),post:i.slice(n[1]+e.length)}}function s(t,e){var s=e.match(t);return s?s[0]:null}function r(t,e,s){var r,i,n,o,a,h=s.indexOf(t),p=s.indexOf(e,h+1),c=h;if(h>=0&&p>0){if(t===e)return[h,p];for(r=[],n=s.length;c>=0&&!a;)c==h?(r.push(c),h=s.indexOf(t,c+1)):1==r.length?a=[r.pop(),p]:((i=r.pop())<n&&(n=i,o=p),p=s.indexOf(e,c+1)),c=h<p&&h>=0?h:p;r.length&&(a=[n,o])}return a}t.exports=e,e.range=r},928:(t,e,s)=>{var r=s(505);t.exports=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return m(function(t){return t.split("\\\\").join(i).split("\\{").join(n).split("\\}").join(o).split("\\,").join(a).split("\\.").join(h)}(t),!0).map(c)};var i="\0SLASH"+Math.random()+"\0",n="\0OPEN"+Math.random()+"\0",o="\0CLOSE"+Math.random()+"\0",a="\0COMMA"+Math.random()+"\0",h="\0PERIOD"+Math.random()+"\0";function p(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function c(t){return t.split(i).join("\\").split(n).join("{").split(o).join("}").split(a).join(",").split(h).join(".")}function l(t){if(!t)return[""];var e=[],s=r("{","}",t);if(!s)return t.split(",");var i=s.pre,n=s.body,o=s.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var h=l(o);return o.length&&(a[a.length-1]+=h.shift(),a.push.apply(a,h)),e.push.apply(e,a),e}function u(t){return"{"+t+"}"}function f(t){return/^-?0\d/.test(t)}function d(t,e){return t<=e}function g(t,e){return t>=e}function m(t,e){var s=[],i=r("{","}",t);if(!i)return[t];var n=i.pre,a=i.post.length?m(i.post,!1):[""];if(/\$$/.test(i.pre))for(var h=0;h<a.length;h++){var c=n+"{"+i.body+"}"+a[h];s.push(c)}else{var _,b,y=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),w=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),v=y||w,x=i.body.indexOf(",")>=0;if(!v&&!x)return i.post.match(/,.*\}/)?m(t=i.pre+"{"+i.body+o+i.post):[t];if(v)_=i.body.split(/\.\./);else if(1===(_=l(i.body)).length&&1===(_=m(_[0],!1).map(u)).length)return a.map((function(t){return i.pre+_[0]+t}));if(v){var S=p(_[0]),O=p(_[1]),M=Math.max(_[0].length,_[1].length),A=3==_.length?Math.abs(p(_[2])):1,P=d;O<S&&(A*=-1,P=g);var E=_.some(f);b=[];for(var j=S;P(j,O);j+=A){var $;if(w)"\\"===($=String.fromCharCode(j))&&($="");else if($=String(j),E){var R=M-$.length;if(R>0){var T=new Array(R+1).join("0");$=j<0?"-"+T+$.slice(1):T+$}}b.push($)}}else{b=[];for(var L=0;L<_.length;L++)b.push.apply(b,m(_[L],!1))}for(L=0;L<b.length;L++)for(h=0;h<a.length;h++){c=n+b[L]+a[h];(!e||v||c)&&s.push(c)}}return s}},489:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.directoryExists=async function(t){try{return await n.default.access(t,i.constants.F_OK),!0}catch(t){return!1}},e.getDirectoryItems=async function t(e,s){const r=[],i=await n.default.readdir(e);for(const a of i){const i=o.default.resolve(e,a);if((await n.default.stat(i)).isDirectory()){const e=await t(i,s);r.push(...e)}else a===s&&r.push(i)}return r},e.filterDirectoryItems=function(t,e,s,r){const i=s.map((t=>new a.Minimatch(t))),n=r.map((t=>new a.Minimatch(t)));return e.filter((e=>{const r=o.default.relative(t,e),a=i.some((t=>t.match(r))),h=n.some((t=>t.match(r)));return(a||!s.length)&&!h}))};const i=s(896),n=r(s(943)),o=r(s(760)),a=s(722)},580:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,s,r){if(r)for(const[t,r]of Object.entries(s))if(n(e,(0,i.default)(r,!1)))return{$ref:`#/components/schemas/${t}`};if("$ref"in e)return e;if(e.oneOf)return{...e,oneOf:e.oneOf.map((e=>t(e,s,!0)))};if(e.anyOf)return{...e,anyOf:e.anyOf.map((e=>t(e,s,!0)))};switch(e.type){case"object":return{...e,properties:Object.entries(e.properties).reduce(((e,[r,i])=>({...e,[r]:t(i,s,!0)})),{})};case"array":return Array.isArray(e.items)?{...e,items:e.items.map((e=>t(e,s,!0)))}:{...e,items:t(e.items,s,!0)}}return e};const i=r(s(292));function n(t,e){if(typeof t!=typeof e)return!1;switch(typeof t){case"object":return null===t?t===e:!!e&&(Array.isArray(t)?!!Array.isArray(e)&&t.every(((t,s)=>n(t,e[s]))):Object.entries(t).every((([t,s])=>n(s,e[t]))));case"function":case"symbol":return!1;default:return t===e}}},37:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.findAppFolderPath=findAppFolderPath,exports.getRouteExports=getRouteExports;const promises_1=__importDefault(__webpack_require__(455)),node_path_1=__importDefault(__webpack_require__(760)),dir_1=__webpack_require__(489),transpile_1=__webpack_require__(380);async function findAppFolderPath(){const t=node_path_1.default.resolve(process.cwd(),"src","app");if(await(0,dir_1.directoryExists)(t))return t;const e=node_path_1.default.resolve(process.cwd(),"app");return await(0,dir_1.directoryExists)(e)?e:null}function injectSchemas(t,e){return t.replace(new RegExp(`\\b${e}\\.`,"g"),`global.schemas[${e}].`).replace(new RegExp(`\\b${e}\\b`,"g"),`"${e}"`)}function safeEval(code,routePath){try{return eval(code)}catch(t){throw console.log(`An error occured while evaluating the route exports from "${routePath}"`),t}}async function getRouteExports(t,e){const s=await promises_1.default.readFile(t,"utf-8"),r=(0,transpile_1.transpile)(s),i=Object.keys(e).reduce(injectSchemas,r);global.schemas=e;const n=safeEval(i,t);return delete global.schemas,n}},976:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return{...t,parameters:t.parameters?.map((t=>function(t,e){return"$ref"in t?t:{...t,schema:n(e,t.schema)}}(t,e))),requestBody:a(e,t.requestBody),responses:p(e,t.responses)}};const i=r(s(580));function n(t,e){return e?(0,i.default)(e,t,!0):e}function o(t,e){return e?Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:{...r,schema:n(t,r.schema)}})),{}):e}function a(t,e){return!e||"$ref"in e?e:{...e,content:o(t,e.content)}}function h(t,e){return"$ref"in e?e:{...e,content:o(t,e.content)}}function p(t,e){return e?Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:h(t,r)})),{}):e}},664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.verifyOptions=function(t=[],e=[]){0;return{include:t.filter((t=>t.endsWith("/route.ts"))),exclude:e.filter((t=>t.endsWith("/route.ts")))}}},683:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.createRouteRecord=function(t,e,s,r){return{method:t.toLocaleLowerCase(),path:n(e,s),apiData:r}},e.bundlePaths=function(t,e){return t.sort(((t,e)=>t.path.localeCompare(e.path))),t.reduce(((t,s)=>({...t,[s.path]:{...t[s.path],[s.method]:(0,i.default)(s.apiData,e)}})),{})};const i=r(s(976));function n(t,e){return t.replace(e,"").replace("[","{").replace("]","}").replaceAll("\\","/").replace("/route.ts","")}},744:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.bundleSchemas=function(t){const e=Object.keys(t).reduce(((e,s)=>({...e,[s]:(0,n.default)(t[s],!1)})),{});return Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:(0,i.default)(r,t,!1)})),{})};const i=r(s(580)),n=r(s(292))},380:(t,e,s)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transpile=function(t){const e=["import createRoute from '@omer-x/next-openapi-route-handler'","import z from 'zod';",n(i(t))];return(0,r.transpile)(e.join("\n"))};const r=s(899);function i(t){return t.replace(/^import\s.+\sfrom\s.+;?$/gm,"").trim()}function n(t){const e=["GET","POST","PUT","PATCH","DELETE"];return`${e.map((t=>`exports.${t} = void 0;\n`))}\n${t}\n${`module.exports = { ${e.map((t=>`${t}: exports.${t}`)).join(", ")} }`}`}},292:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return(0,i.default)(e?t.array():t,{target:"openApi3",$refStrategy:"none"})};const i=r(s(106))},156:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=async function(t,e){const s=(0,a.verifyOptions)(e?.include,e?.exclude),r=await(0,o.findAppFolderPath)();if(!r)throw new Error("This is not a Next.js application!");const c=await(0,n.getDirectoryItems)(r,"route.ts"),l=(0,n.filterDirectoryItems)(r,c,s.include,s.exclude),u=[];for(const e of l){const s=await(0,o.getRouteExports)(e,t);for(const[t,i]of Object.entries(s))i&&i.apiData&&u.push((0,h.createRouteRecord)(t.toLocaleLowerCase(),e,r,i.apiData))}const f=(0,i.default)();return{openapi:"3.1.0",info:{title:f.serviceName,version:f.version},paths:(0,h.bundlePaths)(u,t),components:{schemas:(0,p.bundleSchemas)(t)},tags:[]}};const i=r(s(213)),n=s(489),o=s(37),a=s(664),h=s(683),p=s(744)},213:t=>{"use strict";t.exports=require("@omer-x/package-metadata")},899:t=>{"use strict";t.exports=require("typescript")},106:t=>{"use strict";t.exports=require("zod-to-json-schema")},896:t=>{"use strict";t.exports=require("fs")},943:t=>{"use strict";t.exports=require("fs/promises")},455:t=>{"use strict";t.exports=require("node:fs/promises")},760:t=>{"use strict";t.exports=require("node:path")},274:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assertValidPattern=void 0;e.assertValidPattern=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}},674:(t,e,s)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AST=void 0;const r=s(843),i=s(116),n=new Set(["!","?","+","*","@"]),o=t=>n.has(t),a="(?!\\.)",h=new Set(["[","."]),p=new Set(["..","."]),c=new Set("().*{}+?[]^$\\!"),l="[^/]",u=l+"*?",f=l+"+?";class d{type;#t;#e;#s=!1;#r=[];#i;#n;#o;#a=!1;#h;#p;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#i=e,this.#t=this.#i?this.#i.#t:this,this.#h=this.#t===this?s:this.#t.#h,this.#o=this.#t===this?[]:this.#t.#o,"!"!==t||this.#t.#a||this.#o.push(this),this.#n=this.#i?this.#i.#r.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(const t of this.#r)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#p?this.#p:this.type?this.#p=this.type+"("+this.#r.map((t=>String(t))).join("|")+")":this.#p=this.#r.map((t=>String(t))).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;let t;for(this.toString(),this.#a=!0;t=this.#o.pop();){if("!"!==t.type)continue;let e=t,s=e.#i;for(;s;){for(let r=e.#n+1;!s.type&&r<s.#r.length;r++)for(const e of t.#r){if("string"==typeof e)throw new Error("string part in extglob AST??");e.copyIn(s.#r[r])}e=s,s=e.#i}}return this}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof d&&e.#i===this))throw new Error("invalid part: "+e);this.#r.push(e)}}toJSON(){const t=null===this.type?this.#r.slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...this.#r.map((t=>t.toJSON()))];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&"!"===this.#i?.type)&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(0===this.#n)return!0;const t=this.#i;for(let e=0;e<this.#n;e++){const s=t.#r[e];if(!(s instanceof d&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this)return!0;if("!"===this.#i?.type)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();const t=this.#i?this.#i.#r.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(t){const e=new d(this.type,t);for(const t of this.#r)e.copyIn(t);return e}static#u(t,e,s,r){let i=!1,n=!1,a=-1,h=!1;if(null===e.type){let p=s,c="";for(;p<t.length;){const s=t.charAt(p++);if(i||"\\"===s)i=!i,c+=s;else if(n)p===a+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||p===a+2&&h||(n=!1),c+=s;else if("["!==s)if(r.noext||!o(s)||"("!==t.charAt(p))c+=s;else{e.push(c),c="";const i=new d(s,e);p=d.#u(t,i,p,r),e.push(i)}else n=!0,a=p,h=!1,c+=s}return e.push(c),p}let p=s+1,c=new d(null,e);const l=[];let u="";for(;p<t.length;){const s=t.charAt(p++);if(i||"\\"===s)i=!i,u+=s;else if(n)p===a+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||p===a+2&&h||(n=!1),u+=s;else if("["!==s)if(o(s)&&"("===t.charAt(p)){c.push(u),u="";const e=new d(s,c);c.push(e),p=d.#u(t,e,p,r)}else if("|"!==s){if(")"===s)return""===u&&0===e.#r.length&&(e.#c=!0),c.push(u),u="",e.push(...l,c),p;u+=s}else c.push(u),u="",l.push(c),c=new d(null,e);else n=!0,a=p,h=!1,u+=s}return e.type=null,e.#e=void 0,e.#r=[t.substring(s-1)],p}static fromGlob(t,e={}){const s=new d(null,void 0,e);return d.#u(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[e,s,r,i]=this.toRegExpSource();if(!(r||this.#e||this.#h.nocase&&!this.#h.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;const n=(this.#h.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,n),{_src:e,_glob:t})}get options(){return this.#h}toRegExpSource(t){const e=t??!!this.#h.dot;if(this.#t===this&&this.#l(),!this.type){const s=this.isStart()&&this.isEnd(),r=this.#r.map((e=>{const[r,i,n,o]="string"==typeof e?d.#f(e,this.#e,s):e.toRegExpSource(t);return this.#e=this.#e||n,this.#s=this.#s||o,r})).join("");let n="";if(this.isStart()&&"string"==typeof this.#r[0]){if(!(1===this.#r.length&&p.has(this.#r[0]))){const s=h,i=e&&s.has(r.charAt(0))||r.startsWith("\\.")&&s.has(r.charAt(2))||r.startsWith("\\.\\.")&&s.has(r.charAt(4)),o=!e&&!t&&s.has(r.charAt(0));n=i?"(?!(?:^|/)\\.\\.?(?:$|/))":o?a:""}}let o="";this.isEnd()&&this.#t.#a&&"!"===this.#i?.type&&(o="(?:$|\\/)");return[n+r+o,(0,i.unescape)(r),this.#e=!!this.#e,this.#s]}const s="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:";let n=this.#d(e);if(this.isStart()&&this.isEnd()&&!n&&"!"!==this.type){const t=this.toString();return this.#r=[t],this.type=null,this.#e=void 0,[t,(0,i.unescape)(this.toString()),!1,!1]}let o=!s||t||e?"":this.#d(!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let c="";if("!"===this.type&&this.#c)c=(this.isStart()&&!e?a:"")+f;else{c=r+n+("!"===this.type?"))"+(!this.isStart()||e||t?"":a)+u+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&o?")":"*"===this.type&&o?")?":`)${this.type}`)}return[c,(0,i.unescape)(n),this.#e=!!this.#e,this.#s]}#d(t){return this.#r.map((e=>{if("string"==typeof e)throw new Error("string type in extglob ast??");const[s,r,i,n]=e.toRegExpSource(t);return this.#s=this.#s||n,s})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")}static#f(t,e,s=!1){let n=!1,o="",a=!1;for(let i=0;i<t.length;i++){const h=t.charAt(i);if(n)n=!1,o+=(c.has(h)?"\\":"")+h;else if("\\"!==h){if("["===h){const[s,n,h,p]=(0,r.parseClass)(t,i);if(h){o+=s,a=a||n,i+=h-1,e=e||p;continue}}"*"!==h?"?"!==h?o+=h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):(o+=l,e=!0):(o+=s&&"*"===t?f:u,e=!0)}else i===t.length-1?o+="\\\\":n=!0}return[o,(0,i.unescape)(t),!!e,a]}}e.AST=d},843:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseClass=void 0;const s={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},r=t=>t.replace(/[[\]\\-]/g,"\\$&"),i=t=>t.join("");e.parseClass=(t,e)=>{const n=e;if("["!==t.charAt(n))throw new Error("not in a brace expression");const o=[],a=[];let h=n+1,p=!1,c=!1,l=!1,u=!1,f=n,d="";t:for(;h<t.length;){const e=t.charAt(h);if("!"!==e&&"^"!==e||h!==n+1){if("]"===e&&p&&!l){f=h+1;break}if(p=!0,"\\"!==e||l){if("["===e&&!l)for(const[e,[r,i,p]]of Object.entries(s))if(t.startsWith(e,h)){if(d)return["$.",!1,t.length-n,!0];h+=e.length,p?a.push(r):o.push(r),c=c||i;continue t}l=!1,d?(e>d?o.push(r(d)+"-"+r(e)):e===d&&o.push(r(e)),d="",h++):t.startsWith("-]",h+1)?(o.push(r(e+"-")),h+=2):t.startsWith("-",h+1)?(d=e,h+=2):(o.push(r(e)),h++)}else l=!0,h++}else u=!0,h++}if(f<h)return["",!1,0,!1];if(!o.length&&!a.length)return["$.",!1,t.length-n,!0];if(0===a.length&&1===o.length&&/^\\?.$/.test(o[0])&&!u){const t=2===o[0].length?o[0].slice(-1):o[0];return[(g=t,g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,f-n,!1]}var g;const m="["+(u?"^":"")+i(o)+"]",_="["+(u?"":"^")+i(a)+"]";return[o.length&&a.length?"("+m+"|"+_+")":o.length?m:_,c,f-n,!0]}},363:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.escape=void 0;e.escape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")},722:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.unescape=e.escape=e.AST=e.Minimatch=e.match=e.makeRe=e.braceExpand=e.defaults=e.filter=e.GLOBSTAR=e.sep=e.minimatch=void 0;const i=r(s(928)),n=s(274),o=s(674),a=s(363),h=s(116);e.minimatch=(t,e,s={})=>((0,n.assertValidPattern)(e),!(!s.nocomment&&"#"===e.charAt(0))&&new N(e,s).match(t));const p=/^\*+([^+@!?\*\[\(]*)$/,c=t=>e=>!e.startsWith(".")&&e.endsWith(t),l=t=>e=>e.endsWith(t),u=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),f=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),d=/^\*+\.\*+$/,g=t=>!t.startsWith(".")&&t.includes("."),m=t=>"."!==t&&".."!==t&&t.includes("."),_=/^\.\*+$/,b=t=>"."!==t&&".."!==t&&t.startsWith("."),y=/^\*+$/,w=t=>0!==t.length&&!t.startsWith("."),v=t=>0!==t.length&&"."!==t&&".."!==t,x=/^\?+([^+@!?\*\[\(]*)?$/,S=([t,e=""])=>{const s=P([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},O=([t,e=""])=>{const s=E([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},M=([t,e=""])=>{const s=E([t]);return e?t=>s(t)&&t.endsWith(e):s},A=([t,e=""])=>{const s=P([t]);return e?t=>s(t)&&t.endsWith(e):s},P=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},E=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},j="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",$={sep:"\\"},R={sep:"/"};e.sep="win32"===j?$.sep:R.sep,e.minimatch.sep=e.sep,e.GLOBSTAR=Symbol("globstar **"),e.minimatch.GLOBSTAR=e.GLOBSTAR;e.filter=(t,s={})=>r=>(0,e.minimatch)(r,t,s),e.minimatch.filter=e.filter;const T=(t,e={})=>Object.assign({},t,e);e.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return e.minimatch;const s=e.minimatch;return Object.assign(((e,r,i={})=>s(e,r,T(t,i))),{Minimatch:class extends s.Minimatch{constructor(e,s={}){super(e,T(t,s))}static defaults(e){return s.defaults(T(t,e)).Minimatch}},AST:class extends s.AST{constructor(e,s,r={}){super(e,s,T(t,r))}static fromGlob(e,r={}){return s.AST.fromGlob(e,T(t,r))}},unescape:(e,r={})=>s.unescape(e,T(t,r)),escape:(e,r={})=>s.escape(e,T(t,r)),filter:(e,r={})=>s.filter(e,T(t,r)),defaults:e=>s.defaults(T(t,e)),makeRe:(e,r={})=>s.makeRe(e,T(t,r)),braceExpand:(e,r={})=>s.braceExpand(e,T(t,r)),match:(e,r,i={})=>s.match(e,r,T(t,i)),sep:s.sep,GLOBSTAR:e.GLOBSTAR})},e.minimatch.defaults=e.defaults;e.braceExpand=(t,e={})=>((0,n.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,i.default)(t)),e.minimatch.braceExpand=e.braceExpand;e.makeRe=(t,e={})=>new N(t,e).makeRe(),e.minimatch.makeRe=e.makeRe;e.match=(t,e,s={})=>{const r=new N(e,s);return t=t.filter((t=>r.match(t))),r.options.nonull&&!t.length&&t.push(e),t},e.minimatch.match=e.match;const L=/[?*]|[+@!]\(.*?\)|\[|\]/;class N{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){(0,n.assertValidPattern)(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||j,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&L.test(t[2])||L.test(t[3])),s=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(s)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,r),this.set=r.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let s=0;s<t[e].length;s++)"**"===t[e][s]&&(t[e][s]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let s=e;for(;"**"===t[s+1];)s++;s!==e&&t.splice(e,s-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const s=t[t.length-1];return"**"===e&&"**"===s?t:".."===e&&s&&".."!==s&&"."!==s&&"**"!==s?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const r=t[s];1===s&&""===r&&""===t[0]||("."!==r&&""!==r||(e=!0,t.splice(s,1),s--))}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let s=0;for(;-1!==(s=t.indexOf("..",s+1));){const r=t[s-1];r&&"."!==r&&".."!==r&&"**"!==r&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;-1!==(r=s.indexOf("**",r+1));){let i=r;for(;"**"===s[i+1];)i++;i>r&&s.splice(r+1,i-r);let n=s[r+1];const o=s[r+2],a=s[r+3];if(".."!==n)continue;if(!o||"."===o||".."===o||!a||"."===a||".."===a)continue;e=!0,s.splice(r,1);const h=s.slice(0);h[r]="**",t.push(h),r--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const r=s[t];1===t&&""===r&&""===s[0]||("."!==r&&""!==r||(e=!0,s.splice(t,1),t--))}"."!==s[0]||2!==s.length||"."!==s[1]&&""!==s[1]||(e=!0,s.pop())}let i=0;for(;-1!==(i=s.indexOf("..",i+1));){const t=s[i-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;const t=1===i&&"**"===s[i+1]?["."]:[];s.splice(i-1,2,...t),0===s.length&&s.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){const r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter((t=>t.length))}partsMatch(t,e,s=!1){let r=0,i=0,n=[],o="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])n.push("b"===o?e[i]:t[r]),r++,i++;else if(s&&"**"===t[r]&&e[i]===t[r+1])n.push(t[r]),r++;else if(s&&"**"===e[i]&&t[r]===e[i+1])n.push(e[i]),i++;else if("*"!==t[r]||!e[i]||!this.options.dot&&e[i].startsWith(".")||"**"===e[i]){if("*"!==e[i]||!t[r]||!this.options.dot&&t[r].startsWith(".")||"**"===t[r])return!1;if("a"===o)return!1;o="b",n.push(e[i]),r++,i++}else{if("b"===o)return!1;o="a",n.push(t[r]),r++,i++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,s=0;for(let r=0;r<t.length&&"!"===t.charAt(r);r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,s,r=!1){const i=this.options;if(this.isWindows){const e="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),r=!e&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),i="string"==typeof s[0]&&/^[a-z]:$/i.test(s[0]),n=r?3:e?0:void 0,o=!i&&""===s[0]&&""===s[1]&&"?"===s[2]&&"string"==typeof s[3]&&/^[a-z]:$/i.test(s[3])?3:i?0:void 0;if("number"==typeof n&&"number"==typeof o){const[e,r]=[t[n],s[o]];e.toLowerCase()===r.toLowerCase()&&(s[o]=e,o>n?s=s.slice(o):n>o&&(t=t.slice(n)))}}const{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:s}),this.debug("matchOne",t.length,s.length);for(var o=0,a=0,h=t.length,p=s.length;o<h&&a<p;o++,a++){this.debug("matchOne loop");var c=s[a],l=t[o];if(this.debug(s,c,l),!1===c)return!1;if(c===e.GLOBSTAR){this.debug("GLOBSTAR",[s,c,l]);var u=o,f=a+1;if(f===p){for(this.debug("** at the end");o<h;o++)if("."===t[o]||".."===t[o]||!i.dot&&"."===t[o].charAt(0))return!1;return!0}for(;u<h;){var d=t[u];if(this.debug("\nglobstar while",t,u,s,f,d),this.matchOne(t.slice(u),s.slice(f),r))return this.debug("globstar found match!",u,h,d),!0;if("."===d||".."===d||!i.dot&&"."===d.charAt(0)){this.debug("dot detected!",t,u,s,f);break}this.debug("globstar swallow a segment, and continue"),u++}return!(!r||(this.debug("\n>>> no match, partial?",t,u,s,f),u!==h))}let n;if("string"==typeof c?(n=l===c,this.debug("string match",c,l,n)):(n=c.test(l),this.debug("pattern match",c,l,n)),!n)return!1}if(o===h&&a===p)return!0;if(o===h)return r;if(a===p)return o===h-1&&""===t[o];throw new Error("wtf?")}braceExpand(){return(0,e.braceExpand)(this.pattern,this.options)}parse(t){(0,n.assertValidPattern)(t);const s=this.options;if("**"===t)return e.GLOBSTAR;if(""===t)return"";let r,i=null;(r=t.match(y))?i=s.dot?v:w:(r=t.match(p))?i=(s.nocase?s.dot?f:u:s.dot?l:c)(r[1]):(r=t.match(x))?i=(s.nocase?s.dot?O:S:s.dot?M:A)(r):(r=t.match(d))?i=s.dot?m:g:(r=t.match(_))&&(i=b);const a=o.AST.fromGlob(t,this.options).toMMPattern();return i&&"object"==typeof a&&Reflect.defineProperty(a,"test",{value:i}),a}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const s=this.options,r=s.noglobstar?"[^/]*?":s.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(s.nocase?["i"]:[]);let n=t.map((t=>{const s=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))i.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===e.GLOBSTAR?e.GLOBSTAR:t._src}));return s.forEach(((t,i)=>{const n=s[i+1],o=s[i-1];t===e.GLOBSTAR&&o!==e.GLOBSTAR&&(void 0===o?void 0!==n&&n!==e.GLOBSTAR?s[i+1]="(?:\\/|"+r+"\\/)?"+n:s[i]=r:void 0===n?s[i-1]=o+"(?:\\/|"+r+")?":n!==e.GLOBSTAR&&(s[i-1]=o+"(?:\\/|\\/"+r+"\\/)"+n,s[i+1]=e.GLOBSTAR))})),s.filter((t=>t!==e.GLOBSTAR)).join("/")})).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...i].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const s=this.options;this.isWindows&&(t=t.split("\\").join("/"));const r=this.slashSplit(t);this.debug(this.pattern,"split",r);const i=this.set;this.debug(this.pattern,"set",i);let n=r[r.length-1];if(!n)for(let t=r.length-2;!n&&t>=0;t--)n=r[t];for(let t=0;t<i.length;t++){const o=i[t];let a=r;s.matchBase&&1===o.length&&(a=[n]);if(this.matchOne(a,o,e))return!!s.flipNegate||!this.negate}return!s.flipNegate&&this.negate}static defaults(t){return e.minimatch.defaults(t).Minimatch}}e.Minimatch=N;var k=s(674);Object.defineProperty(e,"AST",{enumerable:!0,get:function(){return k.AST}});var W=s(363);Object.defineProperty(e,"escape",{enumerable:!0,get:function(){return W.escape}});var C=s(116);Object.defineProperty(e,"unescape",{enumerable:!0,get:function(){return C.unescape}}),e.minimatch.AST=o.AST,e.minimatch.Minimatch=N,e.minimatch.escape=a.escape,e.minimatch.unescape=h.unescape},116:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unescape=void 0;e.unescape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var s=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(s.exports,s,s.exports,__webpack_require__),s.exports}var __webpack_exports__=__webpack_require__(156);module.exports=__webpack_exports__})();
1
+ (()=>{var __webpack_modules__={505:t=>{"use strict";function e(t,e,i){t instanceof RegExp&&(t=s(t,i)),e instanceof RegExp&&(e=s(e,i));var n=r(t,e,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+t.length,n[1]),post:i.slice(n[1]+e.length)}}function s(t,e){var s=e.match(t);return s?s[0]:null}function r(t,e,s){var r,i,n,o,a,h=s.indexOf(t),p=s.indexOf(e,h+1),c=h;if(h>=0&&p>0){if(t===e)return[h,p];for(r=[],n=s.length;c>=0&&!a;)c==h?(r.push(c),h=s.indexOf(t,c+1)):1==r.length?a=[r.pop(),p]:((i=r.pop())<n&&(n=i,o=p),p=s.indexOf(e,c+1)),c=h<p&&h>=0?h:p;r.length&&(a=[n,o])}return a}t.exports=e,e.range=r},928:(t,e,s)=>{var r=s(505);t.exports=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return m(function(t){return t.split("\\\\").join(i).split("\\{").join(n).split("\\}").join(o).split("\\,").join(a).split("\\.").join(h)}(t),!0).map(c)};var i="\0SLASH"+Math.random()+"\0",n="\0OPEN"+Math.random()+"\0",o="\0CLOSE"+Math.random()+"\0",a="\0COMMA"+Math.random()+"\0",h="\0PERIOD"+Math.random()+"\0";function p(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function c(t){return t.split(i).join("\\").split(n).join("{").split(o).join("}").split(a).join(",").split(h).join(".")}function l(t){if(!t)return[""];var e=[],s=r("{","}",t);if(!s)return t.split(",");var i=s.pre,n=s.body,o=s.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var h=l(o);return o.length&&(a[a.length-1]+=h.shift(),a.push.apply(a,h)),e.push.apply(e,a),e}function u(t){return"{"+t+"}"}function f(t){return/^-?0\d/.test(t)}function d(t,e){return t<=e}function g(t,e){return t>=e}function m(t,e){var s=[],i=r("{","}",t);if(!i)return[t];var n=i.pre,a=i.post.length?m(i.post,!1):[""];if(/\$$/.test(i.pre))for(var h=0;h<a.length;h++){var c=n+"{"+i.body+"}"+a[h];s.push(c)}else{var _,b,y=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),w=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),v=y||w,x=i.body.indexOf(",")>=0;if(!v&&!x)return i.post.match(/,.*\}/)?m(t=i.pre+"{"+i.body+o+i.post):[t];if(v)_=i.body.split(/\.\./);else if(1===(_=l(i.body)).length&&1===(_=m(_[0],!1).map(u)).length)return a.map((function(t){return i.pre+_[0]+t}));if(v){var S=p(_[0]),O=p(_[1]),M=Math.max(_[0].length,_[1].length),A=3==_.length?Math.abs(p(_[2])):1,P=d;O<S&&(A*=-1,P=g);var E=_.some(f);b=[];for(var j=S;P(j,O);j+=A){var $;if(w)"\\"===($=String.fromCharCode(j))&&($="");else if($=String(j),E){var R=M-$.length;if(R>0){var T=new Array(R+1).join("0");$=j<0?"-"+T+$.slice(1):T+$}}b.push($)}}else{b=[];for(var L=0;L<_.length;L++)b.push.apply(b,m(_[L],!1))}for(L=0;L<b.length;L++)for(h=0;h<a.length;h++){c=n+b[L]+a[h];(!e||v||c)&&s.push(c)}}return s}},489:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.directoryExists=async function(t){try{return await n.default.access(t,i.constants.F_OK),!0}catch(t){return!1}},e.getDirectoryItems=async function t(e,s){const r=[],i=await n.default.readdir(e);for(const a of i){const i=o.default.resolve(e,a);if((await n.default.stat(i)).isDirectory()){const e=await t(i,s);r.push(...e)}else a===s&&r.push(i)}return r},e.filterDirectoryItems=function(t,e,s,r){const i=s.map((t=>new a.Minimatch(t))),n=r.map((t=>new a.Minimatch(t)));return e.filter((e=>{const r=o.default.relative(t,e),a=i.some((t=>t.match(r))),h=n.some((t=>t.match(r)));return(a||!s.length)&&!h}))};const i=s(896),n=r(s(943)),o=r(s(760)),a=s(722)},580:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,s,r){if(r)for(const[t,r]of Object.entries(s))if(n(e,(0,i.default)(r,!1)))return{$ref:`#/components/schemas/${t}`};if("$ref"in e)return e;if(e.oneOf)return{...e,oneOf:e.oneOf.map((e=>t(e,s,!0)))};if(e.anyOf)return{...e,anyOf:e.anyOf.map((e=>t(e,s,!0)))};switch(e.type){case"object":return{...e,properties:Object.entries(e.properties??{}).reduce(((e,[r,i])=>({...e,[r]:t(i,s,!0)})),{})};case"array":return Array.isArray(e.items)?{...e,items:e.items.map((e=>t(e,s,!0)))}:{...e,items:t(e.items,s,!0)}}return e};const i=r(s(292));function n(t,e){if(typeof t!=typeof e)return!1;switch(typeof t){case"object":return null===t?t===e:!!e&&(Array.isArray(t)?!!Array.isArray(e)&&t.every(((t,s)=>n(t,e[s]))):Object.entries(t).every((([t,s])=>n(s,e[t]))));case"function":case"symbol":return!1;default:return t===e}}},37:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.findAppFolderPath=findAppFolderPath,exports.getRouteExports=getRouteExports;const promises_1=__importDefault(__webpack_require__(455)),node_path_1=__importDefault(__webpack_require__(760)),dir_1=__webpack_require__(489),transpile_1=__webpack_require__(380);async function findAppFolderPath(){const t=node_path_1.default.resolve(process.cwd(),"src","app");if(await(0,dir_1.directoryExists)(t))return t;const e=node_path_1.default.resolve(process.cwd(),"app");return await(0,dir_1.directoryExists)(e)?e:null}function injectSchemas(t,e){return t.replace(new RegExp(`\\b${e}\\.`,"g"),`global.schemas[${e}].`).replace(new RegExp(`\\b${e}\\b`,"g"),`"${e}"`)}function safeEval(code,routePath){try{return eval(code)}catch(t){throw console.log(`An error occured while evaluating the route exports from "${routePath}"`),t}}async function getRouteExports(t,e,s){const r=await promises_1.default.readFile(t,"utf-8"),i=(0,transpile_1.transpile)(r,e),n=Object.keys(s).reduce(injectSchemas,i);global.schemas=s;const o=safeEval(n,t);return delete global.schemas,o}},976:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return{...t,parameters:t.parameters?.map((t=>function(t,e){return"$ref"in t?t:{...t,schema:n(e,t.schema)}}(t,e))),requestBody:a(e,t.requestBody),responses:p(e,t.responses)}};const i=r(s(580));function n(t,e){return e?(0,i.default)(e,t,!0):e}function o(t,e){return e?Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:{...r,schema:n(t,r.schema)}})),{}):e}function a(t,e){return!e||"$ref"in e?e:{...e,content:o(t,e.content)}}function h(t,e){return"$ref"in e?e:{...e,content:o(t,e.content)}}function p(t,e){return e?Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:h(t,r)})),{}):e}},664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.verifyOptions=function(t,e){0;return{include:t.filter((t=>t.endsWith("/route.ts"))),exclude:e.filter((t=>t.endsWith("/route.ts")))}}},683:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.createRouteRecord=function(t,e,s,r){return{method:t.toLocaleLowerCase(),path:n(e,s),apiData:r}},e.bundlePaths=function(t,e){return t.sort(((t,e)=>t.path.localeCompare(e.path))),t.reduce(((t,s)=>({...t,[s.path]:{...t[s.path],[s.method]:(0,i.default)(s.apiData,e)}})),{})};const i=r(s(976));function n(t,e){return t.replace(e,"").replace("[","{").replace("]","}").replaceAll("\\","/").replace("/route.ts","")}},744:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.bundleSchemas=function(t){const e=Object.keys(t).reduce(((e,s)=>({...e,[s]:(0,n.default)(t[s],!1)})),{});return Object.entries(e).reduce(((e,[s,r])=>({...e,[s]:(0,i.default)(r,t,!1)})),{})};const i=r(s(580)),n=r(s(292))},380:(t,e,s)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transpile=function(t,e){const s=function(t){const e=["GET","POST","PUT","PATCH","DELETE"],s=e.map((t=>`exports.${t} = void 0;\n`)),r=`module.exports = { ${e.map((t=>`${t}: exports.${t}`)).join(", ")} }`;return`${s}\n${t}\n${r}`}(function(t){return t.replace(/^import\s.+\sfrom\s.+;?$/gm,"").trim()}(t)),i=[`import ${e} from '@omer-x/next-openapi-route-handler';`,"import z from 'zod';",s];return(0,r.transpile)(i.join("\n"))};const r=s(899)},292:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return(0,i.default)(e?t.array():t,{target:"openApi3",$refStrategy:"none"})};const i=r(s(106))},156:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=async function(t,{include:e=[],exclude:s=[],routeDefinerName:r="defineRoute"}={}){const c=(0,a.verifyOptions)(e,s),l=await(0,o.findAppFolderPath)();if(!l)throw new Error("This is not a Next.js application!");const u=await(0,n.getDirectoryItems)(l,"route.ts"),f=(0,n.filterDirectoryItems)(l,u,c.include,c.exclude),d=[];for(const e of f){const s=await(0,o.getRouteExports)(e,r,t);for(const[t,r]of Object.entries(s))r&&r.apiData&&d.push((0,h.createRouteRecord)(t.toLocaleLowerCase(),e,l,r.apiData))}const g=(0,i.default)();return{openapi:"3.1.0",info:{title:g.serviceName,version:g.version},paths:(0,h.bundlePaths)(d,t),components:{schemas:(0,p.bundleSchemas)(t)},tags:[]}};const i=r(s(213)),n=s(489),o=s(37),a=s(664),h=s(683),p=s(744)},213:t=>{"use strict";t.exports=require("@omer-x/package-metadata")},899:t=>{"use strict";t.exports=require("typescript")},106:t=>{"use strict";t.exports=require("zod-to-json-schema")},896:t=>{"use strict";t.exports=require("fs")},943:t=>{"use strict";t.exports=require("fs/promises")},455:t=>{"use strict";t.exports=require("node:fs/promises")},760:t=>{"use strict";t.exports=require("node:path")},274:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assertValidPattern=void 0;e.assertValidPattern=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}},674:(t,e,s)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AST=void 0;const r=s(843),i=s(116),n=new Set(["!","?","+","*","@"]),o=t=>n.has(t),a="(?!\\.)",h=new Set(["[","."]),p=new Set(["..","."]),c=new Set("().*{}+?[]^$\\!"),l="[^/]",u=l+"*?",f=l+"+?";class d{type;#t;#e;#s=!1;#r=[];#i;#n;#o;#a=!1;#h;#p;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#i=e,this.#t=this.#i?this.#i.#t:this,this.#h=this.#t===this?s:this.#t.#h,this.#o=this.#t===this?[]:this.#t.#o,"!"!==t||this.#t.#a||this.#o.push(this),this.#n=this.#i?this.#i.#r.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(const t of this.#r)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#p?this.#p:this.type?this.#p=this.type+"("+this.#r.map((t=>String(t))).join("|")+")":this.#p=this.#r.map((t=>String(t))).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;let t;for(this.toString(),this.#a=!0;t=this.#o.pop();){if("!"!==t.type)continue;let e=t,s=e.#i;for(;s;){for(let r=e.#n+1;!s.type&&r<s.#r.length;r++)for(const e of t.#r){if("string"==typeof e)throw new Error("string part in extglob AST??");e.copyIn(s.#r[r])}e=s,s=e.#i}}return this}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof d&&e.#i===this))throw new Error("invalid part: "+e);this.#r.push(e)}}toJSON(){const t=null===this.type?this.#r.slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...this.#r.map((t=>t.toJSON()))];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&"!"===this.#i?.type)&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(0===this.#n)return!0;const t=this.#i;for(let e=0;e<this.#n;e++){const s=t.#r[e];if(!(s instanceof d&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this)return!0;if("!"===this.#i?.type)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();const t=this.#i?this.#i.#r.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(t){const e=new d(this.type,t);for(const t of this.#r)e.copyIn(t);return e}static#u(t,e,s,r){let i=!1,n=!1,a=-1,h=!1;if(null===e.type){let p=s,c="";for(;p<t.length;){const s=t.charAt(p++);if(i||"\\"===s)i=!i,c+=s;else if(n)p===a+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||p===a+2&&h||(n=!1),c+=s;else if("["!==s)if(r.noext||!o(s)||"("!==t.charAt(p))c+=s;else{e.push(c),c="";const i=new d(s,e);p=d.#u(t,i,p,r),e.push(i)}else n=!0,a=p,h=!1,c+=s}return e.push(c),p}let p=s+1,c=new d(null,e);const l=[];let u="";for(;p<t.length;){const s=t.charAt(p++);if(i||"\\"===s)i=!i,u+=s;else if(n)p===a+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||p===a+2&&h||(n=!1),u+=s;else if("["!==s)if(o(s)&&"("===t.charAt(p)){c.push(u),u="";const e=new d(s,c);c.push(e),p=d.#u(t,e,p,r)}else if("|"!==s){if(")"===s)return""===u&&0===e.#r.length&&(e.#c=!0),c.push(u),u="",e.push(...l,c),p;u+=s}else c.push(u),u="",l.push(c),c=new d(null,e);else n=!0,a=p,h=!1,u+=s}return e.type=null,e.#e=void 0,e.#r=[t.substring(s-1)],p}static fromGlob(t,e={}){const s=new d(null,void 0,e);return d.#u(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[e,s,r,i]=this.toRegExpSource();if(!(r||this.#e||this.#h.nocase&&!this.#h.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;const n=(this.#h.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,n),{_src:e,_glob:t})}get options(){return this.#h}toRegExpSource(t){const e=t??!!this.#h.dot;if(this.#t===this&&this.#l(),!this.type){const s=this.isStart()&&this.isEnd(),r=this.#r.map((e=>{const[r,i,n,o]="string"==typeof e?d.#f(e,this.#e,s):e.toRegExpSource(t);return this.#e=this.#e||n,this.#s=this.#s||o,r})).join("");let n="";if(this.isStart()&&"string"==typeof this.#r[0]){if(!(1===this.#r.length&&p.has(this.#r[0]))){const s=h,i=e&&s.has(r.charAt(0))||r.startsWith("\\.")&&s.has(r.charAt(2))||r.startsWith("\\.\\.")&&s.has(r.charAt(4)),o=!e&&!t&&s.has(r.charAt(0));n=i?"(?!(?:^|/)\\.\\.?(?:$|/))":o?a:""}}let o="";this.isEnd()&&this.#t.#a&&"!"===this.#i?.type&&(o="(?:$|\\/)");return[n+r+o,(0,i.unescape)(r),this.#e=!!this.#e,this.#s]}const s="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:";let n=this.#d(e);if(this.isStart()&&this.isEnd()&&!n&&"!"!==this.type){const t=this.toString();return this.#r=[t],this.type=null,this.#e=void 0,[t,(0,i.unescape)(this.toString()),!1,!1]}let o=!s||t||e?"":this.#d(!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let c="";if("!"===this.type&&this.#c)c=(this.isStart()&&!e?a:"")+f;else{c=r+n+("!"===this.type?"))"+(!this.isStart()||e||t?"":a)+u+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&o?")":"*"===this.type&&o?")?":`)${this.type}`)}return[c,(0,i.unescape)(n),this.#e=!!this.#e,this.#s]}#d(t){return this.#r.map((e=>{if("string"==typeof e)throw new Error("string type in extglob ast??");const[s,r,i,n]=e.toRegExpSource(t);return this.#s=this.#s||n,s})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")}static#f(t,e,s=!1){let n=!1,o="",a=!1;for(let i=0;i<t.length;i++){const h=t.charAt(i);if(n)n=!1,o+=(c.has(h)?"\\":"")+h;else if("\\"!==h){if("["===h){const[s,n,h,p]=(0,r.parseClass)(t,i);if(h){o+=s,a=a||n,i+=h-1,e=e||p;continue}}"*"!==h?"?"!==h?o+=h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):(o+=l,e=!0):(o+=s&&"*"===t?f:u,e=!0)}else i===t.length-1?o+="\\\\":n=!0}return[o,(0,i.unescape)(t),!!e,a]}}e.AST=d},843:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseClass=void 0;const s={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},r=t=>t.replace(/[[\]\\-]/g,"\\$&"),i=t=>t.join("");e.parseClass=(t,e)=>{const n=e;if("["!==t.charAt(n))throw new Error("not in a brace expression");const o=[],a=[];let h=n+1,p=!1,c=!1,l=!1,u=!1,f=n,d="";t:for(;h<t.length;){const e=t.charAt(h);if("!"!==e&&"^"!==e||h!==n+1){if("]"===e&&p&&!l){f=h+1;break}if(p=!0,"\\"!==e||l){if("["===e&&!l)for(const[e,[r,i,p]]of Object.entries(s))if(t.startsWith(e,h)){if(d)return["$.",!1,t.length-n,!0];h+=e.length,p?a.push(r):o.push(r),c=c||i;continue t}l=!1,d?(e>d?o.push(r(d)+"-"+r(e)):e===d&&o.push(r(e)),d="",h++):t.startsWith("-]",h+1)?(o.push(r(e+"-")),h+=2):t.startsWith("-",h+1)?(d=e,h+=2):(o.push(r(e)),h++)}else l=!0,h++}else u=!0,h++}if(f<h)return["",!1,0,!1];if(!o.length&&!a.length)return["$.",!1,t.length-n,!0];if(0===a.length&&1===o.length&&/^\\?.$/.test(o[0])&&!u){const t=2===o[0].length?o[0].slice(-1):o[0];return[(g=t,g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,f-n,!1]}var g;const m="["+(u?"^":"")+i(o)+"]",_="["+(u?"":"^")+i(a)+"]";return[o.length&&a.length?"("+m+"|"+_+")":o.length?m:_,c,f-n,!0]}},363:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.escape=void 0;e.escape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")},722:function(t,e,s){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.unescape=e.escape=e.AST=e.Minimatch=e.match=e.makeRe=e.braceExpand=e.defaults=e.filter=e.GLOBSTAR=e.sep=e.minimatch=void 0;const i=r(s(928)),n=s(274),o=s(674),a=s(363),h=s(116);e.minimatch=(t,e,s={})=>((0,n.assertValidPattern)(e),!(!s.nocomment&&"#"===e.charAt(0))&&new N(e,s).match(t));const p=/^\*+([^+@!?\*\[\(]*)$/,c=t=>e=>!e.startsWith(".")&&e.endsWith(t),l=t=>e=>e.endsWith(t),u=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),f=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),d=/^\*+\.\*+$/,g=t=>!t.startsWith(".")&&t.includes("."),m=t=>"."!==t&&".."!==t&&t.includes("."),_=/^\.\*+$/,b=t=>"."!==t&&".."!==t&&t.startsWith("."),y=/^\*+$/,w=t=>0!==t.length&&!t.startsWith("."),v=t=>0!==t.length&&"."!==t&&".."!==t,x=/^\?+([^+@!?\*\[\(]*)?$/,S=([t,e=""])=>{const s=P([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},O=([t,e=""])=>{const s=E([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},M=([t,e=""])=>{const s=E([t]);return e?t=>s(t)&&t.endsWith(e):s},A=([t,e=""])=>{const s=P([t]);return e?t=>s(t)&&t.endsWith(e):s},P=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},E=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},j="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",$={sep:"\\"},R={sep:"/"};e.sep="win32"===j?$.sep:R.sep,e.minimatch.sep=e.sep,e.GLOBSTAR=Symbol("globstar **"),e.minimatch.GLOBSTAR=e.GLOBSTAR;e.filter=(t,s={})=>r=>(0,e.minimatch)(r,t,s),e.minimatch.filter=e.filter;const T=(t,e={})=>Object.assign({},t,e);e.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return e.minimatch;const s=e.minimatch;return Object.assign(((e,r,i={})=>s(e,r,T(t,i))),{Minimatch:class extends s.Minimatch{constructor(e,s={}){super(e,T(t,s))}static defaults(e){return s.defaults(T(t,e)).Minimatch}},AST:class extends s.AST{constructor(e,s,r={}){super(e,s,T(t,r))}static fromGlob(e,r={}){return s.AST.fromGlob(e,T(t,r))}},unescape:(e,r={})=>s.unescape(e,T(t,r)),escape:(e,r={})=>s.escape(e,T(t,r)),filter:(e,r={})=>s.filter(e,T(t,r)),defaults:e=>s.defaults(T(t,e)),makeRe:(e,r={})=>s.makeRe(e,T(t,r)),braceExpand:(e,r={})=>s.braceExpand(e,T(t,r)),match:(e,r,i={})=>s.match(e,r,T(t,i)),sep:s.sep,GLOBSTAR:e.GLOBSTAR})},e.minimatch.defaults=e.defaults;e.braceExpand=(t,e={})=>((0,n.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,i.default)(t)),e.minimatch.braceExpand=e.braceExpand;e.makeRe=(t,e={})=>new N(t,e).makeRe(),e.minimatch.makeRe=e.makeRe;e.match=(t,e,s={})=>{const r=new N(e,s);return t=t.filter((t=>r.match(t))),r.options.nonull&&!t.length&&t.push(e),t},e.minimatch.match=e.match;const L=/[?*]|[+@!]\(.*?\)|\[|\]/;class N{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){(0,n.assertValidPattern)(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||j,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&L.test(t[2])||L.test(t[3])),s=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(s)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,r),this.set=r.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let s=0;s<t[e].length;s++)"**"===t[e][s]&&(t[e][s]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let s=e;for(;"**"===t[s+1];)s++;s!==e&&t.splice(e,s-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const s=t[t.length-1];return"**"===e&&"**"===s?t:".."===e&&s&&".."!==s&&"."!==s&&"**"!==s?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const r=t[s];1===s&&""===r&&""===t[0]||("."!==r&&""!==r||(e=!0,t.splice(s,1),s--))}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let s=0;for(;-1!==(s=t.indexOf("..",s+1));){const r=t[s-1];r&&"."!==r&&".."!==r&&"**"!==r&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;-1!==(r=s.indexOf("**",r+1));){let i=r;for(;"**"===s[i+1];)i++;i>r&&s.splice(r+1,i-r);let n=s[r+1];const o=s[r+2],a=s[r+3];if(".."!==n)continue;if(!o||"."===o||".."===o||!a||"."===a||".."===a)continue;e=!0,s.splice(r,1);const h=s.slice(0);h[r]="**",t.push(h),r--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const r=s[t];1===t&&""===r&&""===s[0]||("."!==r&&""!==r||(e=!0,s.splice(t,1),t--))}"."!==s[0]||2!==s.length||"."!==s[1]&&""!==s[1]||(e=!0,s.pop())}let i=0;for(;-1!==(i=s.indexOf("..",i+1));){const t=s[i-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;const t=1===i&&"**"===s[i+1]?["."]:[];s.splice(i-1,2,...t),0===s.length&&s.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){const r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter((t=>t.length))}partsMatch(t,e,s=!1){let r=0,i=0,n=[],o="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])n.push("b"===o?e[i]:t[r]),r++,i++;else if(s&&"**"===t[r]&&e[i]===t[r+1])n.push(t[r]),r++;else if(s&&"**"===e[i]&&t[r]===e[i+1])n.push(e[i]),i++;else if("*"!==t[r]||!e[i]||!this.options.dot&&e[i].startsWith(".")||"**"===e[i]){if("*"!==e[i]||!t[r]||!this.options.dot&&t[r].startsWith(".")||"**"===t[r])return!1;if("a"===o)return!1;o="b",n.push(e[i]),r++,i++}else{if("b"===o)return!1;o="a",n.push(t[r]),r++,i++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,s=0;for(let r=0;r<t.length&&"!"===t.charAt(r);r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,s,r=!1){const i=this.options;if(this.isWindows){const e="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),r=!e&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),i="string"==typeof s[0]&&/^[a-z]:$/i.test(s[0]),n=r?3:e?0:void 0,o=!i&&""===s[0]&&""===s[1]&&"?"===s[2]&&"string"==typeof s[3]&&/^[a-z]:$/i.test(s[3])?3:i?0:void 0;if("number"==typeof n&&"number"==typeof o){const[e,r]=[t[n],s[o]];e.toLowerCase()===r.toLowerCase()&&(s[o]=e,o>n?s=s.slice(o):n>o&&(t=t.slice(n)))}}const{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:s}),this.debug("matchOne",t.length,s.length);for(var o=0,a=0,h=t.length,p=s.length;o<h&&a<p;o++,a++){this.debug("matchOne loop");var c=s[a],l=t[o];if(this.debug(s,c,l),!1===c)return!1;if(c===e.GLOBSTAR){this.debug("GLOBSTAR",[s,c,l]);var u=o,f=a+1;if(f===p){for(this.debug("** at the end");o<h;o++)if("."===t[o]||".."===t[o]||!i.dot&&"."===t[o].charAt(0))return!1;return!0}for(;u<h;){var d=t[u];if(this.debug("\nglobstar while",t,u,s,f,d),this.matchOne(t.slice(u),s.slice(f),r))return this.debug("globstar found match!",u,h,d),!0;if("."===d||".."===d||!i.dot&&"."===d.charAt(0)){this.debug("dot detected!",t,u,s,f);break}this.debug("globstar swallow a segment, and continue"),u++}return!(!r||(this.debug("\n>>> no match, partial?",t,u,s,f),u!==h))}let n;if("string"==typeof c?(n=l===c,this.debug("string match",c,l,n)):(n=c.test(l),this.debug("pattern match",c,l,n)),!n)return!1}if(o===h&&a===p)return!0;if(o===h)return r;if(a===p)return o===h-1&&""===t[o];throw new Error("wtf?")}braceExpand(){return(0,e.braceExpand)(this.pattern,this.options)}parse(t){(0,n.assertValidPattern)(t);const s=this.options;if("**"===t)return e.GLOBSTAR;if(""===t)return"";let r,i=null;(r=t.match(y))?i=s.dot?v:w:(r=t.match(p))?i=(s.nocase?s.dot?f:u:s.dot?l:c)(r[1]):(r=t.match(x))?i=(s.nocase?s.dot?O:S:s.dot?M:A)(r):(r=t.match(d))?i=s.dot?m:g:(r=t.match(_))&&(i=b);const a=o.AST.fromGlob(t,this.options).toMMPattern();return i&&"object"==typeof a&&Reflect.defineProperty(a,"test",{value:i}),a}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const s=this.options,r=s.noglobstar?"[^/]*?":s.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(s.nocase?["i"]:[]);let n=t.map((t=>{const s=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))i.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===e.GLOBSTAR?e.GLOBSTAR:t._src}));return s.forEach(((t,i)=>{const n=s[i+1],o=s[i-1];t===e.GLOBSTAR&&o!==e.GLOBSTAR&&(void 0===o?void 0!==n&&n!==e.GLOBSTAR?s[i+1]="(?:\\/|"+r+"\\/)?"+n:s[i]=r:void 0===n?s[i-1]=o+"(?:\\/|"+r+")?":n!==e.GLOBSTAR&&(s[i-1]=o+"(?:\\/|\\/"+r+"\\/)"+n,s[i+1]=e.GLOBSTAR))})),s.filter((t=>t!==e.GLOBSTAR)).join("/")})).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...i].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const s=this.options;this.isWindows&&(t=t.split("\\").join("/"));const r=this.slashSplit(t);this.debug(this.pattern,"split",r);const i=this.set;this.debug(this.pattern,"set",i);let n=r[r.length-1];if(!n)for(let t=r.length-2;!n&&t>=0;t--)n=r[t];for(let t=0;t<i.length;t++){const o=i[t];let a=r;s.matchBase&&1===o.length&&(a=[n]);if(this.matchOne(a,o,e))return!!s.flipNegate||!this.negate}return!s.flipNegate&&this.negate}static defaults(t){return e.minimatch.defaults(t).Minimatch}}e.Minimatch=N;var k=s(674);Object.defineProperty(e,"AST",{enumerable:!0,get:function(){return k.AST}});var W=s(363);Object.defineProperty(e,"escape",{enumerable:!0,get:function(){return W.escape}});var C=s(116);Object.defineProperty(e,"unescape",{enumerable:!0,get:function(){return C.unescape}}),e.minimatch.AST=o.AST,e.minimatch.Minimatch=N,e.minimatch.escape=a.escape,e.minimatch.unescape=h.unescape},116:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unescape=void 0;e.unescape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var s=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(s.exports,s,s.exports,__webpack_require__),s.exports}var __webpack_exports__=__webpack_require__(156);module.exports=__webpack_exports__})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/next-openapi-json-generator",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "a Next.js plugin to generate OpenAPI documentation from route handlers",
5
5
  "keywords": [
6
6
  "next.js",
@@ -41,20 +41,20 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@omer-x/package-metadata": "^0.1.2",
44
- "minimatch": "^9.0.5",
45
- "typescript": "^5.5.3",
46
- "zod-to-json-schema": "^3.23.1"
44
+ "minimatch": "^10.0.1",
45
+ "typescript": "^5.5.4",
46
+ "zod-to-json-schema": "^3.23.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@omer-x/eslint-config": "^1.0.7",
50
- "@omer-x/openapi-types": "^0.1.3",
51
- "@types/node": "^20.14.9",
50
+ "@omer-x/openapi-types": "^0.2.1",
51
+ "@types/node": "^22.4.0",
52
52
  "clean-webpack-plugin": "^4.0.0",
53
53
  "eslint": "^8.57.0",
54
- "ts-jest": "^29.1.5",
54
+ "ts-jest": "^29.2.4",
55
55
  "ts-loader": "^9.5.1",
56
56
  "ts-unused-exports": "^10.1.0",
57
- "webpack": "^5.92.1",
57
+ "webpack": "^5.93.0",
58
58
  "webpack-cli": "^5.1.4",
59
59
  "zod": "^3.23.8"
60
60
  },