@alwatr/resolve-url 5.5.19 โ†’ 5.5.21

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
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/resolve-url@5.5.20...@alwatr/resolve-url@5.5.21) (2025-09-27)
7
+
8
+ ### ๐Ÿงน Miscellaneous Chores
9
+
10
+ * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
11
+
12
+ ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/resolve-url@5.5.19...@alwatr/resolve-url@5.5.20) (2025-09-22)
13
+
14
+ **Note:** Version bump only for package @alwatr/resolve-url
15
+
6
16
  ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/resolve-url@5.5.18...@alwatr/resolve-url@5.5.19) (2025-09-22)
7
17
 
8
18
  **Note:** Version bump only for package @alwatr/resolve-url
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /** ๐Ÿ“ฆ @alwatr/resolve-url v5.5.19 */
2
- __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/resolve-url v5.5.19");
1
+ /** ๐Ÿ“ฆ @alwatr/resolve-url v5.5.21 */
2
+ __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/resolve-url v5.5.21");
3
3
  "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{resolveUrl:()=>resolveUrl});module.exports=__toCommonJS(main_exports);function resolveUrl(...parts){parts=parts.filter(part=>typeof part==="string"&&part.length>0);if(parts.length===0){return""}const leadingSlashes=/^\/+/;const trailingSlashes=/\/+$/;const multipleSlashes=/\/{2,}/g;const prefix=parts[0].indexOf("/")===0?"/":"";return prefix+parts.map(part=>part.replace(leadingSlashes,"").replace(trailingSlashes,"")).filter(part=>part).join("/").replace("://","{{PROTOCOL_SLASH}}").replace(multipleSlashes,"/").replace("{{PROTOCOL_SLASH}}","://")}0&&(module.exports={resolveUrl});
4
4
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /** ๐Ÿ“ฆ @alwatr/resolve-url v5.5.19 */
2
- __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/resolve-url v5.5.19");
1
+ /** ๐Ÿ“ฆ @alwatr/resolve-url v5.5.21 */
2
+ __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/resolve-url v5.5.21");
3
3
  function resolveUrl(...parts){parts=parts.filter(part=>typeof part==="string"&&part.length>0);if(parts.length===0){return""}const leadingSlashes=/^\/+/;const trailingSlashes=/\/+$/;const multipleSlashes=/\/{2,}/g;const prefix=parts[0].indexOf("/")===0?"/":"";return prefix+parts.map(part=>part.replace(leadingSlashes,"").replace(trailingSlashes,"")).filter(part=>part).join("/").replace("://","{{PROTOCOL_SLASH}}").replace(multipleSlashes,"/").replace("{{PROTOCOL_SLASH}}","://")}export{resolveUrl};
4
4
  //# sourceMappingURL=main.mjs.map
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@alwatr/resolve-url",
3
3
  "description": "A tiny TypeScript library to resolve URLs.",
4
- "version": "5.5.19",
4
+ "version": "5.5.21",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "devDependencies": {
8
- "@alwatr/nano-build": "6.3.2",
9
- "@alwatr/prettier-config": "5.0.4",
10
- "@alwatr/tsconfig-base": "6.0.2",
11
- "@alwatr/type-helper": "6.1.2",
8
+ "@alwatr/nano-build": "6.3.4",
9
+ "@alwatr/prettier-config": "5.0.5",
10
+ "@alwatr/tsconfig-base": "6.0.3",
11
+ "@alwatr/type-helper": "6.1.4",
12
12
  "jest": "^30.1.3",
13
13
  "typescript": "^5.9.2"
14
14
  },
@@ -22,7 +22,8 @@
22
22
  "files": [
23
23
  "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
24
24
  "LICENSE",
25
- "!demo/**/*"
25
+ "!demo/**/*",
26
+ "!**/*.test.js"
26
27
  ],
27
28
  "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/resolve-url#readme",
28
29
  "keywords": [
@@ -73,5 +74,5 @@
73
74
  "sideEffects": false,
74
75
  "type": "module",
75
76
  "types": "./dist/main.d.ts",
76
- "gitHead": "8e3b59b7a2d9b9ab28f1ee9da21849e60f7eeb07"
77
+ "gitHead": "c013ded43aff3937cf347de4e99125ab807d99e1"
77
78
  }
package/src/main.test.js DELETED
@@ -1,144 +0,0 @@
1
- import {resolveUrl} from '@alwatr/resolve-url';
2
-
3
- describe('@alwatr/resolve-url - resolveUrl', () => {
4
- it('should handle basic URL parts', () => {
5
- expect(resolveUrl('http://example.com', 'path', 'to', 'resource')).toBe('http://example.com/path/to/resource');
6
- });
7
-
8
- it('should handle multiple slashes in URL parts', () => {
9
- expect(resolveUrl('http://example.com', 'path//to///resource')).toBe('http://example.com/path/to/resource');
10
- });
11
-
12
- it('should handle leading and trailing slashes in URL parts', () => {
13
- expect(resolveUrl('http://example.com/', '/path/', '/to/', '/resource/')).toBe('http://example.com/path/to/resource');
14
- });
15
-
16
- it('should handle multiple slashes at the beginning and end of URL parts', () => {
17
- expect(resolveUrl('http://example.com', '///path', 'to', 'resource///')).toBe('http://example.com/path/to/resource');
18
- });
19
-
20
- it('should preserve the protocol (http)', () => {
21
- expect(resolveUrl('http://example.com', 'path')).toBe('http://example.com/path');
22
- });
23
-
24
- it('should preserve the protocol (https)', () => {
25
- expect(resolveUrl('https://example.com', 'path')).toBe('https://example.com/path');
26
- });
27
-
28
- it('should handle URLs without a protocol', () => {
29
- expect(resolveUrl('example.com', 'path', 'to', 'resource')).toBe('example.com/path/to/resource');
30
- });
31
- it('should handle URLs without a protocol and with multiple slashes', () => {
32
- expect(resolveUrl('example.com//', '//path///', 'to', 'resource')).toBe('example.com/path/to/resource');
33
- });
34
-
35
- it('should handle an empty first part', () => {
36
- expect(resolveUrl('', 'path', 'to', 'resource')).toBe('path/to/resource');
37
- });
38
- it('should handle all empty parts', () => {
39
- expect(resolveUrl('', '', '')).toBe('');
40
- });
41
-
42
- it('should handle multiple empty parts', () => {
43
- expect(resolveUrl('http://example.com', '', 'path', '', 'resource')).toBe('http://example.com/path/resource');
44
- });
45
-
46
- it('should handle a single part URL', () => {
47
- expect(resolveUrl('http://example.com')).toBe('http://example.com');
48
- });
49
- it('should handle a single part URL with trailing slash', () => {
50
- expect(resolveUrl('http://example.com/')).toBe('http://example.com');
51
- });
52
-
53
- it('should handle a single part without protocol', () => {
54
- expect(resolveUrl('example.com')).toBe('example.com');
55
- });
56
-
57
- it('should handle only slashes as input', () => {
58
- expect(resolveUrl('///')).toBe('/');
59
- });
60
-
61
- it('should handle empty input', () => {
62
- expect(resolveUrl()).toBe('');
63
- });
64
-
65
- it('should handle a leading slash in the first part', () => {
66
- expect(resolveUrl('/root', 'sub', 'item')).toBe('/root/sub/item');
67
- });
68
-
69
- it('should handle relative paths', () => {
70
- expect(resolveUrl('path', 'to', 'resource')).toBe('path/to/resource');
71
- });
72
-
73
- it('should handle dot in relative paths', () => {
74
- expect(resolveUrl('path', '.', 'resource')).toBe('path/./resource');
75
- });
76
-
77
- it('should handle parts with special characters', () => {
78
- expect(resolveUrl('http://example.com', 'path with spaces', 'another-part')).toBe('http://example.com/path with spaces/another-part');
79
- });
80
-
81
- it('should handle parts with encoded characters', () => {
82
- //resolveURL should *not* decode.
83
- expect(resolveUrl('http://example.com', 'path%20with%20encoded')).toBe('http://example.com/path%20with%20encoded');
84
- });
85
-
86
- it('should handle parts with plus sign +', () => {
87
- //resolveURL should *not* decode.
88
- expect(resolveUrl('http://example.com', 'path+with+plus')).toBe('http://example.com/path+with+plus');
89
- });
90
-
91
- it('should handle already clean URL', () => {
92
- expect(resolveUrl('http://example.com/path/to/resource')).toBe('http://example.com/path/to/resource');
93
- });
94
-
95
- it('should handle complex url 2', () => {
96
- expect(resolveUrl('//no-protocol/', '/path////test/')).toBe('/no-protocol/path/test');
97
- });
98
-
99
- // Tests moved from main.test.ts
100
- it('should resolve parts correctly', () => {
101
- expect(resolveUrl('a', 'b', 'c')).toBe('a/b/c');
102
- expect(resolveUrl('/a/', '/b/', '/c/')).toBe('/a/b/c');
103
- expect(resolveUrl('a//b', '//c')).toBe('a/b/c');
104
- expect(resolveUrl('http://example.com', 'a')).toBe('http://example.com/a');
105
- expect(resolveUrl('http://example.com/', '/a/')).toBe('http://example.com/a');
106
- });
107
-
108
- it('should handle empty parts', () => {
109
- expect(resolveUrl('a', '', 'c')).toBe('a/c');
110
- expect(resolveUrl('', 'b', 'c')).toBe('b/c');
111
- expect(resolveUrl('a', 'b', '')).toBe('a/b');
112
- expect(resolveUrl('', '', '')).toBe('');
113
- });
114
-
115
- it('should handle single part', () => {
116
- expect(resolveUrl('a')).toBe('a');
117
- expect(resolveUrl('/a/')).toBe('/a');
118
- expect(resolveUrl('')).toBe('');
119
- });
120
-
121
- it('should handle no parts', () => {
122
- expect(resolveUrl()).toBe('');
123
- });
124
-
125
- it('should handle leading/trailing slashes correctly', () => {
126
- expect(resolveUrl('/a', 'b')).toBe('/a/b');
127
- expect(resolveUrl('a', '/b')).toBe('a/b');
128
- expect(resolveUrl('//a', 'b//')).toBe('/a/b');
129
- });
130
-
131
- it('should handle protocol correctly', () => {
132
- expect(resolveUrl('https://example.com//', '//api/', '/v1')).toBe('https://example.com/api/v1');
133
- expect(resolveUrl('ftp://test.com', 'path')).toBe('ftp://test.com/path');
134
- });
135
-
136
- // Test case for the original error
137
- it('should handle null or undefined parts', () => {
138
- expect(resolveUrl('a', undefined, 'c')).toBe('a/c');
139
- expect(resolveUrl(null, 'b', 'c')).toBe('b/c');
140
- expect(resolveUrl('a', 'b', null)).toBe('a/b');
141
- expect(resolveUrl(undefined, undefined, undefined)).toBe('');
142
- expect(resolveUrl('/a', null, 'b', undefined, '/c/')).toBe('/a/b/c');
143
- });
144
- });