compose-paths 1.0.6 → 1.1.1
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 +28 -0
- package/README.md +5 -2
- package/dist/compose-paths.browser.js +2 -2
- package/dist/compose-paths.cjs.js +2 -2
- package/dist/compose-paths.esm.mjs +7 -0
- package/index.mjs +6 -0
- package/package.json +29 -26
- package/dist/compose-paths.esm.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.1] - 2021-12-02
|
|
11
|
+
|
|
12
|
+
### Updated
|
|
13
|
+
|
|
14
|
+
- Minor perf/mem improvement to zip()
|
|
15
|
+
|
|
16
|
+
## [1.1.0] - 2021-08-11
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fix ESM build (import { ... } from 'compose-paths' was not working right)
|
|
21
|
+
|
|
22
|
+
## [1.0.8] - 2021-06-04
|
|
23
|
+
|
|
24
|
+
### Updated
|
|
25
|
+
|
|
26
|
+
- Small refactor for readability
|
|
27
|
+
|
|
28
|
+
## [1.0.7] - 2021-05-06
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- BundlePhobia shield
|
|
33
|
+
|
|
34
|
+
### Updated
|
|
35
|
+
|
|
36
|
+
- Clean-up/comment fillOutPaths()
|
|
37
|
+
|
|
10
38
|
## [1.0.6] - 2021-05-02
|
|
11
39
|
|
|
12
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
alt="MIT license"
|
|
7
7
|
src="https://img.shields.io/npm/l/compose-paths?style=plastic"
|
|
8
8
|
/></a>
|
|
9
|
+
<a href="https://bundlephobia.com/result?p=compose-paths">
|
|
10
|
+
<img
|
|
11
|
+
alt="npm bundle size"
|
|
12
|
+
src="https://img.shields.io/bundlephobia/minzip/compose-paths?style=plastic"
|
|
13
|
+
/></a>
|
|
9
14
|
<a href="https://www.npmjs.com/package/compose-paths">
|
|
10
15
|
<img
|
|
11
16
|
alt="Version"
|
|
@@ -46,8 +51,6 @@ paths.PUBLIC
|
|
|
46
51
|
|
|
47
52
|
### `Path` → `Route` (via aliases)
|
|
48
53
|
|
|
49
|
-
You can also zip-up two of these:
|
|
50
|
-
|
|
51
54
|
```js
|
|
52
55
|
const { composePaths, zip } = require('compose-paths')
|
|
53
56
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* compose-paths
|
|
3
|
-
* v1.
|
|
3
|
+
* v1.1.1
|
|
4
4
|
* https://github.com/shuckster/compose-paths
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
var composePaths=(()=>{var
|
|
7
|
+
var composePaths=(()=>{var a=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var h=a((p,c)=>{(function(n,e,t){typeof c!="undefined"&&c.exports?c.exports=t():typeof define=="function"&&define.amd?define(t):e[n]=t()})("urljoin",p,function(){function n(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var i=e.shift();e[0]=i+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var s=e[o];if(typeof s!="string")throw new TypeError("Url must be a string. Received "+s);s!==""&&(o>0&&(s=s.replace(/^[\/]+/,"")),o<e.length-1?s=s.replace(/[\/]+$/,""):s=s.replace(/[\/]+$/,"/"),t.push(s))}var l=t.join("/");l=l.replace(/\/(\?|&|#[^!])/g,"$1");var u=l.split("?");return l=u.shift()+(u.length>0?"?":"")+u.join("&"),l}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),n(e)}})});var B=a((N,m)=>{m.exports={composePaths:v,zip:I};var g=h(),d="aliases";function v(n){let t=O(n).map(L),i=t.reduce(E,1/0),o=t.map(R(i)),s=_(o),l=x(s),u=s.map(r=>r==null?void 0:r.name).filter(Boolean),f=l;return s.forEach(w(f)),Object.defineProperty(f,d,{value:u,enumerable:!1})}function I(n,e,t){let{aliases:i=[],ignoreAliases:o=!1}=t||{};return(i.length&&!o?i:n[d]).reduce((l,u)=>(o&&i.includes(u)||l.push([n[u],e[u]]),l),[])}var j=/[\r\n]/,P=/(\s*\/\/[^\n\r]*)/,S=/^(\s*)([^$]*)/,$=/\s*=\s*([^$]+)/,b=/^\s*$/;function E(n,{indent:e}){return Math.min(n,e)}function R(n){return({indent:e,content:t})=>({indent:e-n,content:t})}function w(n){return({name:e,index:t})=>{if(!e)return n;let i=n[t];Object.defineProperty(n,e,{value:i,enumerable:!1})}}function x(n){let e=[],t=[],i=-1,o=-1;return n.forEach(({indent:s,content:l})=>{if(o<=0)o=s;else if(s<=i){let u=1+(i-s)/o;for(;u--;)e.pop()}e.push(l),t.push(g(...e)),i=s}),t}function _(n){return n.map((e,t)=>{let{content:i,indent:o}=e,s=i.match($);return s?{index:t,indent:o,content:i.slice(0,i.length-s[0].length),name:s[1]}:{index:t,indent:o,content:i}})}function L(n){var i;let e=[n,"",n],t=(i=n.match(S))!=null?i:e;return{indent:t[1].length,content:t[2]}}function O(n){return[n].flat().reduce((e,t)=>[...e,...t.split(j)],[]).filter(z).map(e=>e.replace(P,""))}function z(n){return!b.test(n)}});return B();})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* compose-paths
|
|
3
|
-
* v1.
|
|
3
|
+
* v1.1.1
|
|
4
4
|
* https://github.com/shuckster/compose-paths
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
module.exports={composePaths:
|
|
7
|
+
module.exports={composePaths:f,zip:h};var p=require("path").join,a="aliases";function f(n){let e=x(n).map(v),s=e.reduce(S,1/0),i=e.map(g(s)),o=b(i),r=_(o),c=o.map(u=>u==null?void 0:u.name).filter(Boolean),l=r;return o.forEach(j(l)),Object.defineProperty(l,a,{value:c,enumerable:!1})}function h(n,t,e){let{aliases:s=[],ignoreAliases:i=!1}=e||{};return(s.length&&!i?s:n[a]).reduce((r,c)=>(i&&s.includes(c)||r.push([n[c],t[c]]),r),[])}var m=/[\r\n]/,d=/(\s*\/\/[^\n\r]*)/,I=/^(\s*)([^$]*)/,A=/\s*=\s*([^$]+)/,P=/^\s*$/;function S(n,{indent:t}){return Math.min(n,t)}function g(n){return({indent:t,content:e})=>({indent:t-n,content:e})}function j(n){return({name:t,index:e})=>{if(!t)return n;let s=n[e];Object.defineProperty(n,t,{value:s,enumerable:!1})}}function _(n){let t=[],e=[],s=-1,i=-1;return n.forEach(({indent:o,content:r})=>{if(i<=0)i=o;else if(o<=s){let c=1+(s-o)/i;for(;c--;)t.pop()}t.push(r),e.push(p(...t)),s=o}),e}function b(n){return n.map((t,e)=>{let{content:s,indent:i}=t,o=s.match(A);return o?{index:e,indent:i,content:s.slice(0,s.length-o[0].length),name:o[1]}:{index:e,indent:i,content:s}})}function v(n){var s;let t=[n,"",n],e=(s=n.match(I))!=null?s:t;return{indent:e[1].length,content:e[2]}}function x(n){return[n].flat().reduce((t,e)=>[...t,...e.split(m)],[]).filter(E).map(t=>t.replace(d,""))}function E(n){return!P.test(n)}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* compose-paths
|
|
3
|
+
* v1.1.1
|
|
4
|
+
* https://github.com/shuckster/compose-paths
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
var a=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var h=a((p,c)=>{(function(n,e,t){typeof c!="undefined"&&c.exports?c.exports=t():typeof define=="function"&&define.amd?define(t):e[n]=t()})("urljoin",p,function(){function n(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var i=e.shift();e[0]=i+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var s=e[o];if(typeof s!="string")throw new TypeError("Url must be a string. Received "+s);s!==""&&(o>0&&(s=s.replace(/^[\/]+/,"")),o<e.length-1?s=s.replace(/[\/]+$/,""):s=s.replace(/[\/]+$/,"/"),t.push(s))}var l=t.join("/");l=l.replace(/\/(\?|&|#[^!])/g,"$1");var u=l.split("?");return l=u.shift()+(u.length>0?"?":"")+u.join("&"),l}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),n(e)}})});var B=a((N,m)=>{m.exports={composePaths:v,zip:I};var g=h(),d="aliases";function v(n){let t=O(n).map(L),i=t.reduce(E,1/0),o=t.map(R(i)),s=_(o),l=x(s),u=s.map(r=>r==null?void 0:r.name).filter(Boolean),f=l;return s.forEach(w(f)),Object.defineProperty(f,d,{value:u,enumerable:!1})}function I(n,e,t){let{aliases:i=[],ignoreAliases:o=!1}=t||{};return(i.length&&!o?i:n[d]).reduce((l,u)=>(o&&i.includes(u)||l.push([n[u],e[u]]),l),[])}var j=/[\r\n]/,P=/(\s*\/\/[^\n\r]*)/,S=/^(\s*)([^$]*)/,$=/\s*=\s*([^$]+)/,b=/^\s*$/;function E(n,{indent:e}){return Math.min(n,e)}function R(n){return({indent:e,content:t})=>({indent:e-n,content:t})}function w(n){return({name:e,index:t})=>{if(!e)return n;let i=n[t];Object.defineProperty(n,e,{value:i,enumerable:!1})}}function x(n){let e=[],t=[],i=-1,o=-1;return n.forEach(({indent:s,content:l})=>{if(o<=0)o=s;else if(s<=i){let u=1+(i-s)/o;for(;u--;)e.pop()}e.push(l),t.push(g(...e)),i=s}),t}function _(n){return n.map((e,t)=>{let{content:i,indent:o}=e,s=i.match($);return s?{index:t,indent:o,content:i.slice(0,i.length-s[0].length),name:s[1]}:{index:t,indent:o,content:i}})}function L(n){var i;let e=[n,"",n],t=(i=n.match(S))!=null?i:e;return{indent:t[1].length,content:t[2]}}function O(n){return[n].flat().reduce((e,t)=>[...e,...t.split(j)],[]).filter(z).map(e=>e.replace(P,""))}function z(n){return!b.test(n)}});export default B();
|
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compose-paths",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Define paths + routes without the repetition.",
|
|
5
5
|
"author": "Conan Theobald",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,15 +12,16 @@
|
|
|
12
12
|
"concatenation"
|
|
13
13
|
],
|
|
14
14
|
"main": "./dist/compose-paths.cjs.js",
|
|
15
|
-
"module": "
|
|
15
|
+
"module": "index.mjs",
|
|
16
16
|
"exports": {
|
|
17
|
+
"import": "./index.mjs",
|
|
17
18
|
"default": "./dist/compose-paths.cjs.js",
|
|
18
|
-
"
|
|
19
|
-
"browser": "./dist/compose-paths.browser.js"
|
|
20
|
-
"require": "./dist/compose-paths.cjs.js"
|
|
19
|
+
"require": "./dist/compose-paths.cjs.js",
|
|
20
|
+
"browser": "./dist/compose-paths.browser.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"dist
|
|
23
|
+
"dist/*",
|
|
24
|
+
"index.mjs",
|
|
24
25
|
"CHANGELOG.md",
|
|
25
26
|
"README.md",
|
|
26
27
|
"LICENSE"
|
|
@@ -37,33 +38,35 @@
|
|
|
37
38
|
"url": "https://github.com/shuckster/compose-paths/issues",
|
|
38
39
|
"email": "bugs+compose-paths@conans.co.uk"
|
|
39
40
|
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"test": "jest",
|
|
42
|
-
"build": "cross-env NODE_ENV=production npm run build:esbuild",
|
|
43
|
-
"build:clean": "rimraf dist/; mkdir -p dist/",
|
|
44
|
-
"build:all": "pnpm run build:clean ; cross-env NODE_ENV=production pnpm run build",
|
|
45
|
-
"build:rollup": "concurrently \"pnpm run build:rollup:node\" \"pnpm run build:rollup:not-node\"",
|
|
46
|
-
"build:rollup:node": "rollup --config ./build-config/rollup.node.js",
|
|
47
|
-
"build:rollup:not-node": "rollup --config ./build-config/rollup.not-node.js",
|
|
48
|
-
"build:esbuild": "node ./build-config/esbuild.js"
|
|
49
|
-
},
|
|
50
41
|
"devDependencies": {
|
|
51
42
|
"@rollup/plugin-babel": "^5.3.0",
|
|
52
|
-
"@rollup/plugin-commonjs": "^
|
|
43
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
53
44
|
"@rollup/plugin-json": "^4.1.0",
|
|
54
|
-
"@rollup/plugin-node-resolve": "^
|
|
55
|
-
"@rollup/plugin-replace": "^
|
|
56
|
-
"concurrently": "^6.0
|
|
45
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
46
|
+
"@rollup/plugin-replace": "^3.0.0",
|
|
47
|
+
"concurrently": "^6.4.0",
|
|
57
48
|
"cross-env": "^7.0.3",
|
|
58
|
-
"esbuild": "^0.
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"eslint-plugin-jest": "^
|
|
61
|
-
"jest": "^
|
|
49
|
+
"esbuild": "^0.13.15",
|
|
50
|
+
"eslint": "^8.3.0",
|
|
51
|
+
"eslint-plugin-jest": "^25.3.0",
|
|
52
|
+
"jest": "^27.4.3",
|
|
53
|
+
"match-iz": "^1.10.3",
|
|
62
54
|
"rimraf": "^3.0.2",
|
|
63
|
-
"rollup": "^2.
|
|
55
|
+
"rollup": "^2.60.2",
|
|
64
56
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
65
57
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
66
58
|
"rollup-plugin-terser": "7.0.2",
|
|
59
|
+
"typescript": "^4.5.2",
|
|
67
60
|
"url-join": "^4.0.1"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"test": "jest",
|
|
64
|
+
"build": "cross-env NODE_ENV=production pnpm run build:esbuild",
|
|
65
|
+
"build:clean": "rimraf dist/; mkdir -p dist/",
|
|
66
|
+
"build:all": "pnpm run build:clean ; cross-env NODE_ENV=production pnpm run build",
|
|
67
|
+
"build:rollup": "concurrently \"pnpm run build:rollup:node\" \"pnpm run build:rollup:not-node\"",
|
|
68
|
+
"build:rollup:node": "rollup --config ./build-config/rollup.node.js",
|
|
69
|
+
"build:rollup:not-node": "rollup --config ./build-config/rollup.not-node.js",
|
|
70
|
+
"build:esbuild": "node ./build-config/esbuild.js"
|
|
68
71
|
}
|
|
69
|
-
}
|
|
72
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* compose-paths
|
|
3
|
-
* v1.0.6
|
|
4
|
-
* https://github.com/shuckster/compose-paths
|
|
5
|
-
* License: MIT
|
|
6
|
-
*/
|
|
7
|
-
var f=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var p=f((h,r)=>{(function(n,e,s){typeof r!="undefined"&&r.exports?r.exports=s():typeof define=="function"&&define.amd?define(s):e[n]=s()})("urljoin",h,function(){function n(e){var s=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var i=e.shift();e[0]=i+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var l=0;l<e.length;l++){var t=e[l];if(typeof t!="string")throw new TypeError("Url must be a string. Received "+t);t!==""&&(l>0&&(t=t.replace(/^[\/]+/,"")),l<e.length-1?t=t.replace(/[\/]+$/,""):t=t.replace(/[\/]+$/,"/"),s.push(t))}var o=s.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var u=o.split("?");return o=u.shift()+(u.length>0?"?":"")+u.join("&"),o}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),n(e)}})});var C=f((z,d)=>{d.exports={composePaths:v,zip:j};var P=p(),m="aliases";function v(n){let s=b(n).map($),i=s.reduce((c,{indent:a})=>Math.min(c,a),Infinity),l=s.map(({indent:c,content:a})=>({indent:c-i,content:a})),t=S(l),o=I(t);t.forEach(({name:c,index:a})=>{if(!c)return o;let g=o[a];Object.defineProperty(o,c,{value:g,enumerable:!1})});let u=t.filter(c=>!!(c==null?void 0:c.name)).map(c=>c.name);return Object.defineProperty(o,m,{value:u,enumerable:!1})}function j(n,e,s){let{aliases:i=[],ignoreAliases:l=!1}=s||{};return(i.length&&!l?i:n[m]).reduce((o,u)=>l&&i.includes(u)?o:[...o,[n[u],e[u]]],[])}var E=/[\r\n]/,O=/(\s*\/\/[^\n\r]*)/,R=/^(\s*)([^$]*)/,w=/\s*=\s*([^$]+)/,x=/^\s*$/;function I(n){let e=[],s=[],i=-1,l=-1;return n.forEach(({indent:t,content:o})=>{if(t<=i){let u=1+(i-t)/l;for(;u--;)e.pop()}else l<=0&&(l=t);e.push(o),s.push(P(...e)),i=t}),s}function S(n){return n.map((e,s)=>{let{content:i,indent:l}=e,t=i.match(w);return t?{index:s,indent:l,content:i.slice(0,i.length-t[0].length),name:t[1]}:{index:s,indent:l,content:i}})}function $(n){var i;let e=[n,"",n],s=(i=n.match(R))!=null?i:e;return{indent:s[1].length,content:s[2]}}function b(n){return[n].flat().reduce((e,s)=>[...e,...s.split(E)],[]).filter(_).map(e=>e.replace(O,""))}function _(n){return!x.test(n)}});export default C();
|