@scalar/postman-to-openapi 0.3.5 → 0.3.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @scalar/postman-to-openapi
2
2
 
3
+ ## 0.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8bc9f20]
8
+ - @scalar/helpers@0.0.3
9
+ - @scalar/oas-utils@0.4.4
10
+
11
+ ## 0.3.6
12
+
13
+ ### Patch Changes
14
+
15
+ - 8165b3b: feat(helpers): added new helpers package
16
+ - Updated dependencies [8165b3b]
17
+ - Updated dependencies [05c22c7]
18
+ - @scalar/oas-utils@0.4.3
19
+ - @scalar/helpers@0.0.2
20
+ - @scalar/openapi-types@0.3.2
21
+
3
22
  ## 0.3.5
4
23
 
5
24
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { REGEX } from '@scalar/oas-utils/helpers';
1
+ import { REGEX } from '@scalar/helpers/regex/regex-helpers';
2
2
  /**
3
3
  * Parses a URL string into its component parts.
4
4
  */
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/urlHelpers.ts"],
4
- "sourcesContent": ["import { REGEX } from '@scalar/oas-utils/helpers'\n\nimport type { ParsedUrl } from '../types'\n\n/**\n * Parses a URL string into its component parts.\n */\nfunction parseUrl(urlString: string): ParsedUrl {\n const url = new URL(urlString)\n return {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port,\n }\n}\n\n/**\n * Extracts the domain (including protocol and port if present) from a given URL.\n */\nexport function getDomainFromUrl(url: string): string {\n const { protocol, hostname, port } = parseUrl(url)\n return `${protocol}//${hostname}${port ? `:${port}` : ''}`\n}\n\n/**\n * Extracts the path from a given URL, removing any Postman variables.\n */\nexport function extractPathFromUrl(url: string | undefined): string {\n if (!url) {\n return '/'\n }\n\n // Remove scheme, domain, query parameters, and hash fragments\n const path = url.replace(/^(?:https?:\\/\\/)?[^/]+(\\/|$)/, '/').split(/[?#]/)[0]\n\n // Replace Postman variables and ensure single leading slash\n const finalPath = ('/' + path.replace(/\\{\\{([^{}]{0,1000})\\}\\}/g, '{$1}').replace(/^\\/+/, '')).replace(/\\/\\/+/g, '/')\n\n return finalPath\n}\n\n/**\n * Normalizes a path by converting colon-style parameters to curly brace style\n * e.g., '/users/:id' becomes '/users/{id}'\n */\nexport const normalizePath = (path: string): string => path.replace(/:(\\w+)/g, '{$1}')\n\n/**\n * Extracts parameter names from a path string.\n * Handles double curly braces {{param}}, single curly braces {param}, and colon format :param.\n */\nexport function extractPathParameterNames(path: string): string[] {\n const params = new Set<string>()\n let match\n\n while ((match = REGEX.TEMPLATE_VARIABLE.exec(path)) !== null) {\n // match[1] contains the parameter name from {{param}}\n // match[2] contains the parameter name from {param}\n // match[0].slice(1) gets the parameter name from :param\n const param = match[1] || match[2] || match[0].slice(1)\n params.add(param.trim())\n }\n\n return Array.from(params)\n}\n"],
4
+ "sourcesContent": ["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\n\nimport type { ParsedUrl } from '../types'\n\n/**\n * Parses a URL string into its component parts.\n */\nfunction parseUrl(urlString: string): ParsedUrl {\n const url = new URL(urlString)\n return {\n protocol: url.protocol,\n hostname: url.hostname,\n port: url.port,\n }\n}\n\n/**\n * Extracts the domain (including protocol and port if present) from a given URL.\n */\nexport function getDomainFromUrl(url: string): string {\n const { protocol, hostname, port } = parseUrl(url)\n return `${protocol}//${hostname}${port ? `:${port}` : ''}`\n}\n\n/**\n * Extracts the path from a given URL, removing any Postman variables.\n */\nexport function extractPathFromUrl(url: string | undefined): string {\n if (!url) {\n return '/'\n }\n\n // Remove scheme, domain, query parameters, and hash fragments\n const path = url.replace(/^(?:https?:\\/\\/)?[^/]+(\\/|$)/, '/').split(/[?#]/)[0]\n\n // Replace Postman variables and ensure single leading slash\n const finalPath = ('/' + path.replace(/\\{\\{([^{}]{0,1000})\\}\\}/g, '{$1}').replace(/^\\/+/, '')).replace(/\\/\\/+/g, '/')\n\n return finalPath\n}\n\n/**\n * Normalizes a path by converting colon-style parameters to curly brace style\n * e.g., '/users/:id' becomes '/users/{id}'\n */\nexport const normalizePath = (path: string): string => path.replace(/:(\\w+)/g, '{$1}')\n\n/**\n * Extracts parameter names from a path string.\n * Handles double curly braces {{param}}, single curly braces {param}, and colon format :param.\n */\nexport function extractPathParameterNames(path: string): string[] {\n const params = new Set<string>()\n let match\n\n while ((match = REGEX.TEMPLATE_VARIABLE.exec(path)) !== null) {\n // match[1] contains the parameter name from {{param}}\n // match[2] contains the parameter name from {param}\n // match[0].slice(1) gets the parameter name from :param\n const param = match[1] || match[2] || match[0].slice(1)\n params.add(param.trim())\n }\n\n return Array.from(params)\n}\n"],
5
5
  "mappings": "AAAA,SAAS,aAAa;AAOtB,SAAS,SAAS,WAA8B;AAC9C,QAAM,MAAM,IAAI,IAAI,SAAS;AAC7B,SAAO;AAAA,IACL,UAAU,IAAI;AAAA,IACd,UAAU,IAAI;AAAA,IACd,MAAM,IAAI;AAAA,EACZ;AACF;AAKO,SAAS,iBAAiB,KAAqB;AACpD,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI,SAAS,GAAG;AACjD,SAAO,GAAG,QAAQ,KAAK,QAAQ,GAAG,OAAO,IAAI,IAAI,KAAK,EAAE;AAC1D;AAKO,SAAS,mBAAmB,KAAiC;AAClE,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAGA,QAAM,OAAO,IAAI,QAAQ,gCAAgC,GAAG,EAAE,MAAM,MAAM,EAAE,CAAC;AAG7E,QAAM,aAAa,MAAM,KAAK,QAAQ,4BAA4B,MAAM,EAAE,QAAQ,QAAQ,EAAE,GAAG,QAAQ,UAAU,GAAG;AAEpH,SAAO;AACT;AAMO,MAAM,gBAAgB,CAAC,SAAyB,KAAK,QAAQ,WAAW,MAAM;AAM9E,SAAS,0BAA0B,MAAwB;AAChE,QAAM,SAAS,oBAAI,IAAY;AAC/B,MAAI;AAEJ,UAAQ,QAAQ,MAAM,kBAAkB,KAAK,IAAI,OAAO,MAAM;AAI5D,UAAM,QAAQ,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC;AACtD,WAAO,IAAI,MAAM,KAAK,CAAC;AAAA,EACzB;AAEA,SAAO,MAAM,KAAK,MAAM;AAC1B;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "export",
20
20
  "scalar"
21
21
  ],
22
- "version": "0.3.5",
22
+ "version": "0.3.7",
23
23
  "engines": {
24
24
  "node": ">=20"
25
25
  },
@@ -38,11 +38,12 @@
38
38
  ],
39
39
  "module": "dist/index.js",
40
40
  "dependencies": {
41
- "@scalar/oas-utils": "0.4.2",
42
- "@scalar/openapi-types": "0.3.1"
41
+ "@scalar/helpers": "0.0.3",
42
+ "@scalar/oas-utils": "0.4.4",
43
+ "@scalar/openapi-types": "0.3.2"
43
44
  },
44
45
  "devDependencies": {
45
- "@scalar/build-tooling": "0.2.1"
46
+ "@scalar/build-tooling": "0.2.2"
46
47
  },
47
48
  "scripts": {
48
49
  "build": "scalar-build-esbuild",