@flex-development/mlly 1.0.0-beta.5 → 1.0.0-beta.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.
@@ -1 +1 @@
1
- var p=Object.defineProperty;var n=(e,t)=>p(e,"name",{value:t,configurable:!0});import d from"#internal/chain-or-call";import l from"#internal/fs";import c from"#internal/is-promise";import h from"#internal/process";import u from"#lib/is-file";import x from"#lib/is-module-id";import R from"#lib/to-url";import{ERR_UNSUPPORTED_ESM_URL_SCHEME as U}from"@flex-development/errnode";import{ok as i}from"devlop";var I=E;function E(e,t){if(!x(e))return null;const o={...t,fs:t?.fs??l,handlers:{"data:":w,"file:":L,"http:":m,"https:":m,"node:":S,...t?.handlers},req:{...t?.req},schemes:new Set(t?.schemes?[...t.schemes]:["data","file","http","https","node"])},s=R(e);let f;if(f=o.handlers[s.protocol],typeof f!="function"){if(o.ignoreErrors)return;throw new U(s,[...o.schemes],h.platform==="win32")}let r=f.call(o,s);return c(r)&&r.then(a=>r=a),d(r,()=>(i(!c(r),"expected `code` to be resolved"),r))}n(E,"getSource");function w(e){const[t,o=""]=e.pathname.split(",");return i(e.protocol==="data:","expected `data:` URL"),i(t!==void 0,"expected `mime` to be a string"),Buffer.from(decodeURIComponent(o),t.endsWith("base64")?"base64":"utf8")}n(w,"data");function L(e){i(e.protocol==="file:","expected `file:` URL");const t=u(e,this.fs);return d(t,o=>o??t?this.fs.readFile(e,this.encoding):null)}n(L,"file");async function m(e){return i(/^https?:$/.test(e.protocol),"expected `http:` or `https:` URL"),(await fetch(e.href,this.req)).text()}n(m,"https");function S(e){i(e.protocol==="node:","expected `node:` URL")}n(S,"node");export{I as default};
1
+ var c=Object.defineProperty;var o=(e,t)=>c(e,"name",{value:t,configurable:!0});import m from"#internal/fs";import p from"#internal/identity";import a from"#internal/process";import h from"#lib/is-file";import l from"#lib/is-module-id";import u from"#lib/to-url";import{ERR_UNSUPPORTED_ESM_URL_SCHEME as R}from"@flex-development/errnode";import s from"@flex-development/when";import{ok as n}from"devlop";var I=U;function U(e,t){if(!l(e))return null;const r={...t,fs:t?.fs??m,handlers:{"data:":x,"file:":w,"http:":d,"https:":d,"node:":E,...t?.handlers},req:{...t?.req},schemes:new Set(t?.schemes?[...t.schemes]:["data","file","http","https","node"])},f=u(e);let i;if(i=r.handlers[f.protocol],typeof i!="function"){if(r.ignoreErrors)return;throw new R(f,[...r.schemes],a.platform==="win32")}return s(i.call(r,f),p)}o(U,"getSource");function x(e){const[t,r=""]=e.pathname.split(",");return n(e.protocol==="data:","expected `data:` URL"),n(t!==void 0,"expected `mime` to be a string"),Buffer.from(decodeURIComponent(r),t.endsWith("base64")?"base64":"utf8")}o(x,"data");function w(e){return n(e.protocol==="file:","expected `file:` URL"),s(h(e,this.fs),t=>t?this.fs.readFile(e,this.encoding):null)}o(w,"file");async function d(e){return n(/^https?:$/.test(e.protocol),"expected `http:` or `https:` URL"),(await fetch(e.href,this.req)).text()}o(d,"https");function E(e){n(e.protocol==="node:","expected `node:` URL")}o(E,"node");export{I as default};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var o=(t,i)=>s(t,"name",{value:i,configurable:!0});import n from"#internal/chain-or-call";import m from"#internal/constant";import a from"#internal/fs";import l from"#internal/identity";import e from"#internal/is-promise";import c from"#lib/is-module-id";var C=p;function p(t,i){if(c(t))try{typeof t=="string"&&t.startsWith("file:")&&(t=new URL(t));let r=(i??a).stat(t);return e(r)&&(r=r.then(l,m(null))),n(r,()=>e(r)?r.then(f=>f?.isDirectory()??!1):r.isDirectory())}catch{}return!1}o(p,"isDirectory");export{C as default};
1
+ var f=Object.defineProperty;var e=(t,r)=>f(t,"name",{value:r,configurable:!0});import s from"#internal/constant";import i from"#internal/fs";import n from"#lib/is-module-id";import a from"@flex-development/when";var h=m;function m(t,r){if(typeof t=="string"&&t.startsWith("file:")&&(t=new URL(t)),!n(t))return!1;r??=i;try{return a(r.stat(t),o=>o.isDirectory(),s(!1))}catch{return!1}}e(m,"isDirectory");export{h as default};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var e=(t,i)=>s(t,"name",{value:i,configurable:!0});import n from"#internal/chain-or-call";import l from"#internal/constant";import m from"#internal/fs";import a from"#internal/identity";import o from"#internal/is-promise";import p from"#lib/is-module-id";var C=u;function u(t,i){if(p(t))try{typeof t=="string"&&t.startsWith("file:")&&(t=new URL(t));let r=(i??m).stat(t);return o(r)&&(r=r.then(a,l(null))),n(r,()=>o(r)?r.then(f=>f?.isFile()??!1):r.isFile())}catch{}return!1}e(u,"isFile");export{C as default};
1
+ var o=Object.defineProperty;var e=(t,r)=>o(t,"name",{value:r,configurable:!0});import s from"#internal/constant";import i from"#internal/fs";import n from"#lib/is-module-id";import a from"@flex-development/when";var w=l;function l(t,r){if(typeof t=="string"&&t.startsWith("file:")&&(t=new URL(t)),!n(t))return!1;r??=i;try{return a(r.stat(t),f=>f.isFile(),s(!1))}catch{return!1}}e(l,"isFile");export{w as default};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var m=(o,r)=>f(o,"name",{value:r,configurable:!0});import u from"#internal/is-promise";import d from"#lib/can-parse-url";import h from"#lib/is-file";import U from"#lib/is-module-id";import g from"#lib/root";import k from"#lib/to-url";import l from"@flex-development/pathe";var v=w;function w(o,r,a){if(U(o)&&d(o)){const i={scope:null},n=[];let e=new URL(o),t;for(;String(e)!==String(r??g)&&(e=k(l.dot.repeat(/[/\\]$/.test(e.pathname)?2:1),e),!/node_modules[/\\]$/.test(e.pathname));){const s=new URL("package.json",e),p=new URL(l.dot,s);if(t=h(s,a),u(t))n.push(t.then(c=>{if(!(!c||i.scope))return i.scope=p,void 0}));else if(t)return p}if(n.length)return Promise.all(n).then(()=>i.scope)}return null}m(w,"lookupPackageScope");export{v as default};
1
+ var f=Object.defineProperty;var l=(o,r)=>f(o,"name",{value:r,configurable:!0});import u from"#lib/can-parse-url";import d from"#lib/is-file";import h from"#lib/is-module-id";import U from"#lib/root";import g from"#lib/to-url";import m from"@flex-development/pathe";import{isThenable as k}from"@flex-development/when";var v=w;function w(o,r,a){if(h(o)&&u(o)){const n={scope:null},i=[];let e=new URL(o),t;for(;String(e)!==String(r??U)&&(e=g(m.dot.repeat(/[/\\]$/.test(e.pathname)?2:1),e),!/node_modules[/\\]$/.test(e.pathname));){const s=new URL("package.json",e),p=new URL(m.dot,s);if(t=d(s,a),k(t))i.push(t.then(c=>{if(!(!c||n.scope))return n.scope=p,void 0}));else if(t)return p}if(i.length)return Promise.all(i).then(()=>n.scope)}return null}l(w,"lookupPackageScope");export{v as default};
@@ -1 +1 @@
1
- var d=Object.defineProperty;var n=(r,o)=>d(r,"name",{value:o,configurable:!0});import u from"#internal/chain-or-call";import P from"#internal/fs";import g from"#lib/can-parse-url";import w from"#lib/is-file";import A from"#lib/is-module-id";import{ERR_INVALID_PACKAGE_CONFIG as I}from"@flex-development/errnode";import l from"@flex-development/pathe";var N=R;function R(r,o,a,s){if(A(r)&&g(r)){const e=new URL("package.json",r),c=w(e,s??=P);return u(c,p=>{if(!(p??c))return null;const m=s.readFile(e,"utf8");return u(m,(h=m)=>{try{const t=JSON.parse(h);if(k(t))return t;throw new Error("Invalid package manifest object",{cause:t})}catch(t){const f=t,i=new I(e.pathname,a&&o?`"${o}" from ${l.fileURLToPath(a)}`:o&&l.fileURLToPath(o),f.message);throw i.cause=f,i}})})}return null}n(R,"readPackageJson");function k(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}n(k,"isPackageJson");export{N as default};
1
+ var p=Object.defineProperty;var n=(r,o)=>p(r,"name",{value:o,configurable:!0});import h from"#internal/fs";import d from"#lib/can-parse-url";import w from"#lib/is-file";import P from"#lib/is-module-id";import{ERR_INVALID_PACKAGE_CONFIG as g}from"@flex-development/errnode";import u from"@flex-development/pathe";import c from"@flex-development/when";var J=A;function A(r,o,a,m){if(P(r)&&d(r)){const e=new URL("package.json",r);return c(w(e,m??=h),i=>i?c(m.readFile(e,"utf8"),l=>{try{const t=JSON.parse(l);if(I(t))return t;throw new Error("Invalid package manifest object",{cause:t})}catch(t){const s=t,f=new g(e.pathname,a&&o?`"${o}" from ${u.fileURLToPath(a)}`:o&&u.fileURLToPath(o),s.message);throw f.cause=s,f}}):null)}return null}n(A,"readPackageJson");function I(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}n(I,"isPackageJson");export{J as default};
@@ -1 +1 @@
1
- var i=Object.defineProperty;var a=(t,e)=>i(t,"name",{value:e,configurable:!0});import O from"#internal/constant";import U from"#internal/identity";import x from"#internal/is-promise";import D from"#lib/default-extensions";import y from"#lib/resolve-alias";import{moduleResolve as _}from"#lib/resolver";import{codes as f,isNodeError as N}from"@flex-development/errnode";import m from"@flex-development/pathe";var k=P;function P(t,e,r){let n;try{n=_(y(t,{...r,parent:e})??t,e,r?.conditions,r?.mainFields,r?.preserveSymlinks,r?.fs)}catch(d){return c(d,t,e,r)}return x(n)?n.then(d=>h(d,t,r?.ext),d=>c(d,t,e,r)):h(n,t,r?.ext)}a(P,"resolveModule");function h(t,e,r){return t.protocol==="file:"&&r!==void 0&&(t.href=typeof r=="function"?m.changeExt(t.href,r(t,e)):m.changeExt(t.href,r),t=new URL(m.toPosix(t.href).replace(/\/index$/,m.sep))),t}a(h,"changeExt");function c(t,e,r,n){const d=new Set([f.ERR_MODULE_NOT_FOUND,f.ERR_UNSUPPORTED_DIR_IMPORT]);if(N(t)&&d.has(t.code)){const E=[...n?.extensions??D],R=[];let s,l=[];t.code===f.ERR_MODULE_NOT_FOUND&&!t.url&&(l=[e.startsWith("@types/")?e:"@types/"+e].flatMap(o=>[o,o+m.sep+"index.d.ts",o+m.sep+"index.d.mts",o+m.sep+"index.d.cts"])),t.code===f.ERR_MODULE_NOT_FOUND&&t.url&&(l=E.map(o=>e+m.formatExt(o))),t.code===f.ERR_UNSUPPORTED_DIR_IMPORT&&(l=E.map(o=>e+m.sep+"index"+m.formatExt(o)));for(let o of l){try{if(s=_(o,r,n?.conditions,n?.mainFields,n?.preserveSymlinks,n?.fs),!x(s))return h(s,e,n?.ext)}catch{continue}R.push(s.then(U,O(void 0)))}if(R.length)return Promise.all(R).then(o=>{for(const u of o)if(u)return h(u,e,n?.ext);throw t})}throw t}a(c,"retry");export{k as default};
1
+ var c=Object.defineProperty;var m=(t,n)=>c(t,"name",{value:n,configurable:!0});import i from"#internal/constant";import x from"#internal/identity";import U from"#lib/default-extensions";import y from"#lib/resolve-alias";import{moduleResolve as _}from"#lib/resolver";import{codes as f,isNodeError as D}from"@flex-development/errnode";import d from"@flex-development/pathe";import{isThenable as N,when as T}from"@flex-development/when";var j=P;function P(t,n,e){t=String(t),t=y(t,{...e,parent:n})??t;let r;try{r=_(t,n,e?.conditions,e?.mainFields,e?.preserveSymlinks,e?.fs)}catch(l){return O(l,t,n,e)}return T(r,{chain:m(l=>R(l,t,e?.ext),"chain"),reject:m(l=>O(l,t,n,e),"reject")})}m(P,"resolveModule");function O(t,n,e,r){const l=new Set([f.ERR_MODULE_NOT_FOUND,f.ERR_UNSUPPORTED_DIR_IMPORT]);if(D(t)&&l.has(t.code)){const u=[...r?.extensions??U],h=[];let a,s=[];t.code===f.ERR_MODULE_NOT_FOUND&&!t.url&&(s=[n.startsWith("@types/")?n:"@types/"+n].flatMap(o=>[o,o+d.sep+"index.d.ts",o+d.sep+"index.d.mts",o+d.sep+"index.d.cts"])),t.code===f.ERR_MODULE_NOT_FOUND&&t.url&&(s=u.map(o=>n+d.formatExt(o))),t.code===f.ERR_UNSUPPORTED_DIR_IMPORT&&(s=u.map(o=>n+d.sep+"index"+d.formatExt(o)));for(let o of s){try{if(a=_(o,e,r?.conditions,r?.mainFields,r?.preserveSymlinks,r?.fs),!N(a))return R(a,n,r?.ext)}catch{continue}h.push(a.then(x,i(void 0)))}if(h.length)return Promise.all(h).then(o=>{for(const E of o)if(E)return R(E,n,r?.ext);throw t})}throw t}m(O,"retry");function R(t,n,e){if(t.protocol==="file:"&&e!==void 0){let r;typeof e=="function"?r=e(t,n):typeof e=="object"&&e?r=d.extToValue(t.href,e):r=e,t.href=d.changeExt(t.href,r||null),t=new URL(d.toPosix(t.href).replace(/\/index$/,d.sep))}return t}m(R,"rewriteExtension");export{j as default};
@@ -1 +1 @@
1
- var J=Object.defineProperty;var w=(t,e)=>J(t,"name",{value:e,configurable:!0});import P from"#internal/chain-or-call";import L from"#internal/chars";import b from"#internal/check-invalid-segments";import _ from"#internal/constant";import Q from"#internal/fs";import j from"#internal/identity";import A from"#internal/invalid-package-target";import X from"#internal/invalid-subpath";import a from"#internal/is-promise";import q from"#lib/can-parse-url";import z from"#lib/default-conditions";import M from"#lib/default-main-fields";import Y from"#lib/is-array-index";import C from"#lib/is-directory";import W from"#lib/is-file";import Z from"#lib/is-imports-subpath";import k from"#lib/is-module-id";import g from"#lib/is-relative-specifier";import $ from"#lib/lookup-package-scope";import ee from"#lib/pattern-match";import U from"#lib/read-package-json";import oe from"#lib/root";import te from"#lib/to-url";import{codes as re,ERR_INVALID_MODULE_SPECIFIER as S,ERR_INVALID_PACKAGE_CONFIG as F,ERR_MODULE_NOT_FOUND as N,ERR_PACKAGE_IMPORT_NOT_DEFINED as ne,ERR_PACKAGE_PATH_NOT_EXPORTED as ie,ERR_UNSUPPORTED_DIR_IMPORT as le,ERR_UNSUPPORTED_RESOLVE_REQUEST as G}from"@flex-development/errnode";import{isBuiltin as V}from"@flex-development/is-builtin";import R from"@flex-development/pathe";import{ok as y}from"devlop";function K(t,e,l,d,s){if(e){const f={url:null},i=[];for(const r of l??M){const o=e[r],h=[];let c;typeof o=="string"&&h.push(o,`./${o}.js`,`./${o}.json`,`./${o}.node`,`./${o}/index.js`,`./${o}/index.json`,`./${o}/index.node`),h.push("./index.js","./index.json","./index.node");for(const u of h.map(m=>new URL(m,t)))if(c=W(u,s),a(c))i.push(c.then(m=>{if(!(!m||f.url))return f.url=u,void 0}));else if(c&&!i.length)return u}if(i.length)return Promise.all(i).then(()=>n(f.url))}return n(null);function n(f){if(f)return f;throw new N(R.fileURLToPath(t),d&&R.fileURLToPath(d))}}w(K,"legacyMainResolve");function fe(t,e,l,d,s,n){const f=typeof e=="string"?e.slice(0,e.indexOf(":")+1):e.protocol;let i;if(R.isAbsolute(t)||g(t))try{i=new URL(t,e)}catch(r){let o;throw o=new G(t,e),o.cause=r,o}else if(f==="file:"&&Z(t))i=B(t,e,l,d,n);else try{i=new URL(t)}catch(r){if(f==="data:"&&!V(t)){let o;throw o=new G(String(t),e),o.cause=r,o}i=p(t,e,l,d,n)}return a(i)&&i.then(r=>i=r,_(null)),P(i,()=>{if(y(k(i),"expected `resolved` to be a URL"),i.protocol!=="file:")return i;const r=R.fileURLToPath(e);let o=i;if(/%2f|%5c/i.test(o.pathname)){const c='must not include encoded "/" or "\\" characters';throw new S(o.pathname,c,r)}const h=C(o,n);return P(h,c=>{if(c??h){let m;throw m=new le(o.pathname,r),m.url=String(o),m}const u=W(o,n);return P(u,m=>{if(m??u){if(s)return o;const v=(n??Q).realpath(o);return P(v,E=>{const{hash:x,search:O}=o;return o=new URL(R.pathToFileURL(E??v)),o.hash=x,o.search=O,o})}throw new N(o.pathname,r,o)})})})}w(fe,"moduleResolve");function D(t,e,l,d,s,n){if(l){let f=!1;if(!Array.isArray(l)&&typeof l=="object")for(const[r,o]of Object.getOwnPropertyNames(l).entries()){let h=o[0]===R.dot;if(r===0){f=h;continue}if(f!==h)throw new F(R.fileURLToPath(new URL("package.json",t)),s,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}let i=null;if(e===R.dot){let r;Array.isArray(l)||typeof l=="string"||!f?r=l:Object.prototype.hasOwnProperty.call(l,e)&&(r=l[e]),r!==void 0&&(i=T(t,r,e,null,!1,d,null,s,n))}else!Array.isArray(l)&&typeof l=="object"&&f&&(y(e.startsWith("./"),'expected `subpath` to start with "./"'),i=I(e,l,t,!1,d,null,s,n));if(y(!a(i),"expected `resolved` not to be a promise"),i)return i}throw new ie(R.fileURLToPath(t),e,s&&R.fileURLToPath(s))}w(D,"packageExportsResolve");function I(t,e,l,d,s,n,f,i){const r=ee(t,e);return r&&(y(e,"expected `matchObject`"),T(l,e[r[0]],...r,d,s,n,f,i))}w(I,"packageImportsExportsResolve");function B(t,e,l,d,s){if(!t.startsWith(L.hash)||t===L.hash||t.startsWith(L.hash+R.sep))throw new S(t,"is not a valid internal imports specifier name",R.fileURLToPath(e));let n=$(e,null,s);return a(n)&&n.then(f=>n=f,_(null)),P(n,()=>{y(!a(n),"expected `scope` to be resolved");const f=U(n,t,e,s);return P(f,r=>{if(r=r===void 0?f:r){y(n instanceof URL,"expected `scope` to be a URL");let o;if(o=I(t,r.imports,n,!0,l,d,e,s),a(o))return o.then(i);if(o)return o}return i(null)});function i(r){if(y(!a(n),"expected `scope` to be resolved"),r)return r;throw new ne(t,n&&R.fileURLToPath(n),e&&R.fileURLToPath(e))}})}w(B,"packageImportsResolve");function p(t,e,l,d,s){if(V(t))return te(t);let n=t.indexOf(R.sep),f=!!t;t[0]===L.at&&(n===-1?f=!1:n=t.indexOf(R.sep,n+1));const i=n===-1?t:t.slice(0,n);if(/^\.|%|\\/.exec(i)!==null&&(f=!1),!f){const u="is not a valid package name";throw new S(t,u,e)}const r=R.dot+(n===-1?L.empty:t.slice(n));let o=H(i,r,e,l,s);return a(o)&&o.then(u=>o=u,_(null)),P(o,()=>{if(y(!a(o),"expected `self` to be resolved"),o)return o;const u={url:null},m=[];let v,E=new URL(e);for(;String(E)!==String(oe);){const x=new URL(`node_modules/${i}/`,E);if(v=C(x,s),a(v))m.push(v.then(O=>{if(!(!O||u.url))return u.url=c(x),void 0}));else if(v)return c(x);E=new URL(R.dirname(E.href))}return m.length?P(Promise.all(m),()=>a(u.url)?u.url.then(h):h(u.url)):h(null)});function h(u){if(u)return u;throw new N(i,e&&R.fileURLToPath(e))}w(h,"check");function c(u){let m=U(u,null,e,s);return a(m)&&m.then(v=>m=v,_(null)),P(m,()=>(y(!a(m),"expected `pjson` to be resolved"),m?.exports?D(u,r,m.exports,l,e,s):r!==R.dot?new URL(r,u):K(u,m,d,e,s)))}w(c,"resolve")}w(p,"packageResolve");function H(t,e,l,d,s){const n=$(l,null,s);return P(n,f=>{const i=U(f=f===void 0?n:f,null,l,s);return P(i,r=>{if(r===void 0&&(r=i),r?.exports&&t===r.name)return y(f,"expected `scope`"),D(f,e,r.exports,d,l,s)})})}w(H,"packageSelfResolve");function T(t,e,l,d,s,n,f,i,r){if(e===null)return e;if(Array.isArray(e)){const o=[];let h,c;for(const u of e){try{c=T(t,u,l,d,s,n,f,i,r)}catch(m){if(h=m,h.code!==re.ERR_INVALID_PACKAGE_TARGET)throw h}if(a(c))o.push(c.then(j,j));else if(c&&!o.length)return c}if(o.length)return h=null,Promise.all(o).then(u=>{for(const m of u){if(k(m))return m;/* v8 ignore else -- @preserve */m&&(h=m)}/* v8 ignore else -- @preserve */if(h)throw h;/* v8 ignore next -- @preserve */return null});if(h)throw h;return null}if(typeof e=="object"){for(const c of Object.getOwnPropertyNames(e))if(Y(c))throw new F(R.fileURLToPath(new URL("package.json",t)),i,'"exports" cannot contain numeric property keys');n??=z,Array.isArray(n)&&(n=new Set(n));const o=[];let h;for(const c of Object.getOwnPropertyNames(e))if(n.has(c)||c==="default"){if(h=T(t,e[c],l,d,s,n,f,i,r),a(h))o.push(h.then(j));else if(h!==void 0&&!o.length)return h}return o.length?Promise.all(o).then(c=>c.find(u=>!!u)):void 0}if(typeof e=="string"){if(!e.startsWith("./")){if(!s||e.startsWith("../")||e.startsWith(R.sep)||q(e))throw A(t,l,e,s,i);return p(typeof d=="string"?e.replace(L.asterisk,d):e,t,n,f,r)}if(y(e.startsWith("./"),'expected `target` to start with "./"'),b(e))throw A(t,l,e,s,i);let o=new URL(e,t);if(!o.href.startsWith(String(t)))throw A(t,l,e,s,i);if(typeof d=="string"){if(d&&b(d))throw X(l,d,t,s,i);e=e.replace(L.asterisk,d),y(typeof e=="string","expected string `target`"),o=new URL(e,t)}return o}throw A(t,l,e,s,i)}w(T,"packageTargetResolve");export{K as legacyMainResolve,fe as moduleResolve,D as packageExportsResolve,I as packageImportsExportsResolve,B as packageImportsResolve,p as packageResolve,H as packageSelfResolve,T as packageTargetResolve};
1
+ var H=Object.defineProperty;var w=(o,e)=>H(o,"name",{value:e,configurable:!0});import y from"#internal/chars";import j from"#internal/check-invalid-segments";import J from"#internal/fs";import O from"#internal/identity";import v from"#internal/invalid-package-target";import Q from"#internal/invalid-subpath";import X from"#lib/can-parse-url";import q from"#lib/default-conditions";import z from"#lib/default-main-fields";import M from"#lib/is-array-index";import W from"#lib/is-directory";import b from"#lib/is-file";import Y from"#lib/is-imports-subpath";import Z from"#lib/is-module-id";import p from"#lib/is-relative-specifier";import C from"#lib/lookup-package-scope";import ee from"#lib/pattern-match";import S from"#lib/read-package-json";import oe from"#lib/root";import te from"#lib/to-url";import{codes as re,ERR_INVALID_MODULE_SPECIFIER as U,ERR_INVALID_PACKAGE_CONFIG as $,ERR_MODULE_NOT_FOUND as N,ERR_PACKAGE_IMPORT_NOT_DEFINED as ne,ERR_PACKAGE_PATH_NOT_EXPORTED as ie,ERR_UNSUPPORTED_DIR_IMPORT as fe,ERR_UNSUPPORTED_RESOLVE_REQUEST as F}from"@flex-development/errnode";import{isBuiltin as G}from"@flex-development/is-builtin";import c from"@flex-development/pathe";import{isThenable as P,when as a}from"@flex-development/when";import{ok as L}from"devlop";function V(o,e,f,m,l){if(e){const u={url:null},n=[];for(const t of f??z){const i=e[t],s=[];let h;typeof i=="string"&&s.push(i,`./${i}.js`,`./${i}.json`,`./${i}.node`,`./${i}/index.js`,`./${i}/index.json`,`./${i}/index.node`),s.push("./index.js","./index.json","./index.node");for(const d of s.map(R=>new URL(R,o)))if(h=b(d,l),P(h))n.push(h.then(R=>{if(!(!R||u.url))return u.url=d,void 0}));else if(h&&!n.length)return d}if(n.length)return Promise.all(n).then(()=>r(u.url))}return r(null);function r(u){if(u)return u;throw new N(c.fileURLToPath(o),m&&c.fileURLToPath(m))}}w(V,"legacyMainResolve");function le(o,e,f,m,l,r){const u=typeof e=="string"?e.slice(0,e.indexOf(":")+1):e.protocol;let n;if(c.isAbsolute(o)||p(o))try{n=new URL(o,e)}catch(t){let i;throw i=new F(o,e),i.cause=t,i}else if(u==="file:"&&Y(o))n=g(o,e,f,m,r);else try{n=new URL(o)}catch(t){if(u==="data:"&&!G(o)){let i;throw i=new F(String(o),e),i.cause=t,i}n=I(o,e,f,m,r)}return a(n,t=>{if(t.protocol!=="file:")return t;const i=c.fileURLToPath(e);if(/%2f|%5c/i.test(t.pathname)){const s='must not include encoded "/" or "\\" characters';throw new U(t.pathname,s,i)}return a(W(t,r),s=>{if(s){let h;throw h=new fe(t.pathname,i),h.url=String(t),h}return a(b(t,r),h=>{if(h)return l?t:a((r??J).realpath(t),d=>{const{hash:R,search:E}=t;return t=new URL(c.pathToFileURL(d)),t.hash=R,t.search=E,t});throw new N(t.pathname,i,t)})})})}w(le,"moduleResolve");function k(o,e,f,m,l,r){if(f){let u=!1;if(!Array.isArray(f)&&typeof f=="object")for(const[t,i]of Object.getOwnPropertyNames(f).entries()){let s=i[0]===c.dot;if(t===0){u=s;continue}if(u!==s)throw new $(c.fileURLToPath(new URL("package.json",o)),l,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}let n=null;if(e===c.dot){let t;Array.isArray(f)||typeof f=="string"||!u?t=f:Object.prototype.hasOwnProperty.call(f,e)&&(t=f[e]),t!==void 0&&(n=T(o,t,e,null,!1,m,null,l,r))}else!Array.isArray(f)&&typeof f=="object"&&u&&(L(e.startsWith("./"),'expected `subpath` to start with "./"'),n=D(e,f,o,!1,m,null,l,r));if(L(!P(n),"expected `resolved` not to be a promise"),n)return n}throw new ie(c.fileURLToPath(o),e,l&&c.fileURLToPath(l))}w(k,"packageExportsResolve");function D(o,e,f,m,l,r,u,n){const t=ee(o,e);return t&&(L(e,"expected `matchObject`"),T(f,e[t[0]],...t,m,l,r,u,n))}w(D,"packageImportsExportsResolve");function g(o,e,f,m,l){if(!o.startsWith(y.hash)||o===y.hash||o.startsWith(y.hash+c.sep))throw new U(o,"is not a valid internal imports specifier name",c.fileURLToPath(e));return a(C(e,null,l),r=>{return a(S(r,o,e,l),n=>{if(n){L(r instanceof URL,"expected `scope` to be a URL");let t;if(t=D(o,n.imports,r,!0,f,m,e,l),P(t))return t.then(u);if(t)return t}return u(null)});function u(n){if(n)return n;throw new ne(o,r&&c.fileURLToPath(r),e&&c.fileURLToPath(e))}})}w(g,"packageImportsResolve");function I(o,e,f,m,l){if(G(o))return te(o);let r=o.indexOf(c.sep),u=!!o;o[0]===y.at&&(r===-1?u=!1:r=o.indexOf(c.sep,r+1));const n=r===-1?o:o.slice(0,r);if(/^\.|%|\\/.exec(n)!==null&&(u=!1),!u){const d="is not a valid package name";throw new U(o,d,e)}const t=c.dot+(r===-1?y.empty:o.slice(r)),i=K(n,t,e,f,l);return a(i,d=>{if(d)return d;const R={url:null},E=[];let _,A=new URL(e);for(;String(A)!==String(oe);){const x=new URL(`node_modules/${n}/`,A);if(_=W(x,l),P(_))E.push(_.then(B=>{if(!(!B||R.url))return R.url=h(x),void 0}));else if(_)return h(x);A=new URL(c.dirname(A.href))}return E.length?a(Promise.all(E),()=>P(R.url)?R.url.then(s):s(R.url)):s(null)});function s(d){if(d)return d;throw new N(n,e&&c.fileURLToPath(e))}function h(d){return a(S(d,null,e,l),R=>R?.exports?k(d,t,R.exports,f,e,l):t!==c.dot?new URL(t,d):V(d,R,m,e,l))}}w(I,"packageResolve");function K(o,e,f,m,l){return a(C(f,null,l),r=>a(S(r,null,f,l),u=>{if(u?.exports&&o===u.name)return L(r,"expected `scope`"),k(r,e,u.exports,m,f,l)}))}w(K,"packageSelfResolve");function T(o,e,f,m,l,r,u,n,t){if(e===null)return e;if(Array.isArray(e)){const i=[];let s,h;for(const d of e){try{h=T(o,d,f,m,l,r,u,n,t)}catch(R){if(s=R,s.code!==re.ERR_INVALID_PACKAGE_TARGET)throw s}if(P(h))i.push(h.then(O,O));else if(h&&!i.length)return h}if(i.length)return s=null,Promise.all(i).then(d=>{for(const R of d){if(Z(R))return R;/* v8 ignore else -- @preserve */R&&(s=R)}/* v8 ignore else -- @preserve */if(s)throw s;/* v8 ignore next -- @preserve */return null});if(s)throw s;return null}if(typeof e=="object"){for(const h of Object.getOwnPropertyNames(e))if(M(h))throw new $(c.fileURLToPath(new URL("package.json",o)),n,'"exports" cannot contain numeric property keys');r??=q,Array.isArray(r)&&(r=new Set(r));const i=[];let s;for(const h of Object.getOwnPropertyNames(e))if(r.has(h)||h==="default"){if(s=T(o,e[h],f,m,l,r,u,n,t),P(s))i.push(s.then(O));else if(s!==void 0&&!i.length)return s}return i.length?Promise.all(i).then(h=>h.find(d=>!!d)):void 0}if(typeof e=="string"){if(!e.startsWith("./")){if(!l||e.startsWith("../")||e.startsWith(c.sep)||X(e))throw v(o,f,e,l,n);return I(typeof m=="string"?e.replace(y.asterisk,m):e,o,r,u,t)}if(L(e.startsWith("./"),'expected `target` to start with "./"'),j(e))throw v(o,f,e,l,n);let i=new URL(e,o);if(!i.href.startsWith(String(o)))throw v(o,f,e,l,n);if(typeof m=="string"){if(m&&j(m))throw Q(f,m,o,l,n);e=e.replace(y.asterisk,m),L(typeof e=="string","expected string `target`"),i=new URL(e,o)}return i}throw v(o,f,e,l,n)}w(T,"packageTargetResolve");export{V as legacyMainResolve,le as moduleResolve,k as packageExportsResolve,D as packageImportsExportsResolve,g as packageImportsResolve,I as packageResolve,K as packageSelfResolve,T as packageTargetResolve};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flex-development/mlly",
3
3
  "description": "ESM utilities for modern tooling — spec-compliant, developer-friendly, and fully typed",
4
- "version": "1.0.0-beta.5",
4
+ "version": "1.0.0-beta.7",
5
5
  "keywords": [
6
6
  "bundle",
7
7
  "cli",
@@ -72,9 +72,7 @@
72
72
  "default": "./dist/interfaces/*.d.mts"
73
73
  },
74
74
  "#internal/fs": {
75
- "types": {
76
- "mlly": "./src/internal/fs.d.mts"
77
- },
75
+ "types": "./src/internal/fs.d.mts",
78
76
  "browser": {
79
77
  "mlly": "./src/internal/fs.browser.mts",
80
78
  "default": "./dist/internal/fs.browser.mjs"
@@ -124,7 +122,7 @@
124
122
  },
125
123
  "scripts": {
126
124
  "build": "yarn clean:build && tsc -p tsconfig.build.json --noEmit false && yarn bundle:dts && yarn minify:build",
127
- "bundle:dts": "dtsroll --conditions=mlly && trash ./dist/{interfaces,types} && trash ./dist/{internal,lib}/index.d.mts || exit 0",
125
+ "bundle:dts": "rollup --config=rollup.config.mts && trash dist/{interfaces,types} && trash dist/{internal,lib}/*.d.mts",
128
126
  "check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn check:types && yarn test:cov && yarn pack && yarn check:types:build && attw package.tgz && yarn clean:pack",
129
127
  "check:format": "dprint check --incremental=false",
130
128
  "check:lint": "eslint --exit-on-fatal-error --max-warnings 0 .",
@@ -167,12 +165,14 @@
167
165
  "@flex-development/is-builtin": "3.2.0",
168
166
  "@flex-development/pathe": "4.0.2",
169
167
  "@flex-development/pkg-types": "4.1.0",
168
+ "@flex-development/when": "1.0.0",
170
169
  "devlop": "1.1.0"
171
170
  },
172
171
  "devDependencies": {
173
172
  "@arethetypeswrong/cli": "0.18.2",
174
173
  "@commitlint/cli": "20.4.1",
175
174
  "@commitlint/types": "20.4.0",
175
+ "@edge-runtime/vm": "5.0.0",
176
176
  "@faker-js/faker": "10.3.0",
177
177
  "@flex-development/commitlint-config": "1.0.1",
178
178
  "@flex-development/eslint-config": "1.1.1",
@@ -181,6 +181,7 @@
181
181
  "@flex-development/remark-preset": "1.0.0",
182
182
  "@flex-development/tsconfig-types": "5.1.0",
183
183
  "@flex-development/tutils": "6.0.0-alpha.25",
184
+ "@rollup/plugin-node-resolve": "16.0.3",
184
185
  "@tsconfig/strictest": "2.0.8",
185
186
  "@types/chai": "5.2.3",
186
187
  "@types/chai-string": "1.4.5",
@@ -197,7 +198,6 @@
197
198
  "cross-env": "10.1.0",
198
199
  "cspell": "9.6.4",
199
200
  "dprint": "0.51.1",
200
- "dtsroll": "1.7.6",
201
201
  "editorconfig": "3.0.1",
202
202
  "esbuild": "0.27.3",
203
203
  "eslint": "9.39.2",
@@ -211,12 +211,14 @@
211
211
  "remark": "15.0.1",
212
212
  "remark-cli": "12.0.1",
213
213
  "remark-lint-maximum-heading-length": "4.1.1",
214
+ "rollup": "4.57.1",
215
+ "rollup-plugin-dts": "6.3.0",
214
216
  "sh-syntax": "0.5.8",
215
217
  "trash-cli": "7.2.0",
216
218
  "typescript": "5.9.3",
217
219
  "unified": "11.0.5",
218
220
  "vfile": "6.0.3",
219
- "vite-tsconfig-paths": "6.1.0",
221
+ "vite-tsconfig-paths": "6.1.1",
220
222
  "vitest": "4.0.18"
221
223
  },
222
224
  "resolutions": {
@@ -1,51 +0,0 @@
1
- /**
2
- * @file Internal - chainOrCall
3
- * @module mlly/internal/chainOrCall
4
- */
5
- import type { Awaitable } from '@flex-development/mlly';
6
- export default chainOrCall;
7
- /**
8
- * Chain function parameters.
9
- *
10
- * @internal
11
- *
12
- * @template {any} R
13
- * The previous resolved value
14
- * @template {any[]} P
15
- * The function parameters
16
- */
17
- type ChainParams<R, P extends any[]> = [...P, R?];
18
- /**
19
- * Chain a callback, calling the function after `promise` is resolved,
20
- * otherwise synchronously call `fn`.
21
- *
22
- * @see {@linkcode Awaitable}
23
- * @see {@linkcode ChainParams}
24
- *
25
- * @internal
26
- *
27
- * @template {any} T
28
- * The resolved value of `fn`
29
- * @template {any} [R=unknown]
30
- * The previous resolved value
31
- * @template {any[]} [P=any[]]
32
- * The function parameters
33
- * @template {any} [Self=unknown]
34
- * The `this` context of `fn`
35
- *
36
- * @this {void}
37
- *
38
- * @param {Awaitable<R>} promise
39
- * The promise to chain or the resolved value
40
- * @param {(this: Self, ...params: ChainParams<R, P>) => Awaitable<T>} fn
41
- * The function to call
42
- * @param {(e: unknown) => Awaitable<T>} [reject]
43
- * The callback to fire when a promise is rejected
44
- * @param {Self | null | undefined} [self]
45
- * The `this` context of `fn`
46
- * @param {P} params
47
- * The arguments to pass to `fn`
48
- * @return {Awaitable<T>}
49
- * A new promise to resolve or the result of `fn`
50
- */
51
- declare function chainOrCall<T = unknown, R = unknown, P extends any[] = any[], Self = unknown>(this: void, promise: Awaitable<R>, fn: (this: Self, ...params: ChainParams<R, P>) => Awaitable<T>, reject?: (e: unknown) => Awaitable<T>, self?: Self | null | undefined, ...params: P): Awaitable<T>;
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var i=(l,t)=>a(l,"name",{value:t,configurable:!0});import e from"#internal/is-promise";var f=u;function u(l,t,n,r,...c){return e(l)?l.then(o=>t.call(r,...c,o),n):t.call(r,...c)}i(u,"chainOrCall");export{f as default};
@@ -1,16 +0,0 @@
1
- /**
2
- * @file Internal - chars
3
- * @module mlly/internal/chars
4
- */
5
- /**
6
- * Characters that may have special meaning.
7
- *
8
- * @enum {string}
9
- */
10
- declare enum chars {
11
- asterisk = "*",
12
- at = "@",
13
- empty = "",
14
- hash = "#"
15
- }
16
- export default chars;
@@ -1,18 +0,0 @@
1
- /**
2
- * @file Internal - checkInvalidSegments
3
- * @module mlly/internal/checkInvalidSegments
4
- */
5
- /**
6
- * Check `str` for invalid path segments.
7
- *
8
- * @internal
9
- *
10
- * @this {void}
11
- *
12
- * @param {string} str
13
- * The package target or subpath pattern match to check
14
- * @return {boolean}
15
- * `true` if `str` contains invalid path segments, `false` otherwise
16
- */
17
- declare function checkInvalidSegments(this: void, str: string): boolean;
18
- export default checkInvalidSegments;
@@ -1,21 +0,0 @@
1
- /**
2
- * @file Internal - constant
3
- * @module mlly/internal/constant
4
- */
5
- /**
6
- * Create a function that returns a constant value.
7
- *
8
- * @internal
9
- *
10
- * @template {unknown} T
11
- * The value
12
- *
13
- * @this {void}
14
- *
15
- * @param {T} value
16
- * The value
17
- * @return {(this: void) => T}
18
- * `value`
19
- */
20
- declare function constant<T>(this: void, value: T): (this: void) => T;
21
- export default constant;
@@ -1,12 +0,0 @@
1
- /**
2
- * @file Internal - fs/browser
3
- * @module mlly/internal/fs/browser
4
- */
5
- import type { FileSystem } from '@flex-development/mlly';
6
- /**
7
- * The file system API.
8
- *
9
- * @const {FileSystem} fs
10
- */
11
- declare const fs: FileSystem;
12
- export default fs;
@@ -1,12 +0,0 @@
1
- /**
2
- * @file Internal - fs/node
3
- * @module mlly/internal/fs/node
4
- */
5
- import type { FileSystem } from '@flex-development/mlly';
6
- /**
7
- * The file system API.
8
- *
9
- * @const {FileSystem} fs
10
- */
11
- declare const fs: FileSystem;
12
- export default fs;
@@ -1,21 +0,0 @@
1
- /**
2
- * @file Internal - identity
3
- * @module mlly/internal/identity
4
- */
5
- /**
6
- * Return a constant value.
7
- *
8
- * @internal
9
- *
10
- * @template {unknown} T
11
- * The value
12
- *
13
- * @this {void}
14
- *
15
- * @param {T} value
16
- * The value
17
- * @return {T}
18
- * `value`
19
- */
20
- declare function identity<T>(this: void, value: T): T;
21
- export default identity;
@@ -1,31 +0,0 @@
1
- /**
2
- * @file Internal - invalidPackageTarget
3
- * @module mlly/internal/invalidPackageTarget
4
- */
5
- import { type ErrInvalidPackageTarget } from '@flex-development/errnode';
6
- import type { ModuleId } from '@flex-development/mlly';
7
- /**
8
- * Create an {@linkcode ERR_INVALID_PACKAGE_TARGET} error.
9
- *
10
- * @see {@linkcode ErrInvalidPackageTarget}
11
- * @see {@linkcode ModuleId}
12
- *
13
- * @internal
14
- *
15
- * @this {void}
16
- *
17
- * @param {ModuleId} packageUrl
18
- * The URL of the directory containing the `package.json` file
19
- * @param {string} subpath
20
- * The subpath pattern
21
- * @param {unknown} target
22
- * The invalid package target
23
- * @param {boolean | null | undefined} [isImports]
24
- * Whether `target` is internal to the package
25
- * @param {ModuleId | null | undefined} [parent]
26
- * The URL of the parent module
27
- * @return {ErrInvalidPackageTarget}
28
- * New node error
29
- */
30
- declare function invalidPackageTarget(this: void, packageUrl: ModuleId, subpath: string, target: unknown, isImports?: boolean | null | undefined, parent?: ModuleId | null | undefined): ErrInvalidPackageTarget;
31
- export default invalidPackageTarget;
@@ -1,32 +0,0 @@
1
- /**
2
- * @file Internal - invalidSubpath
3
- * @module mlly/internal/invalidSubpath
4
- */
5
- import { type ErrInvalidModuleSpecifier } from '@flex-development/errnode';
6
- import type { ModuleId } from '@flex-development/mlly';
7
- /**
8
- * Create an {@linkcode ERR_INVALID_MODULE_SPECIFIER} error for an invalid
9
- * subpath pattern match.
10
- *
11
- * @see {@linkcode ErrInvalidModuleSpecifier}
12
- * @see {@linkcode ModuleId}
13
- *
14
- * @internal
15
- *
16
- * @this {void}
17
- *
18
- * @param {string} subpath
19
- * The subpath pattern
20
- * @param {string} patternMatch
21
- * The subpath pattern match
22
- * @param {ModuleId} packageUrl
23
- * The URL of the directory containing the `package.json` file
24
- * @param {boolean | null | undefined} [isImports]
25
- * Whether `target` is internal to the package
26
- * @param {ModuleId | null | undefined} [parent]
27
- * The URL of the parent module
28
- * @return {ErrInvalidModuleSpecifier}
29
- * New node error
30
- */
31
- declare function invalidSubpath(this: void, subpath: string, patternMatch: string, packageUrl: ModuleId, isImports?: boolean | null | undefined, parent?: ModuleId | null | undefined): ErrInvalidModuleSpecifier;
32
- export default invalidSubpath;
@@ -1,21 +0,0 @@
1
- /**
2
- * @file Internal - isPromise
3
- * @module mlly/internal/isPromise
4
- */
5
- /**
6
- * Check if `value` is a {@linkcode PromiseLike} object.
7
- *
8
- * @internal
9
- *
10
- * @template {any} T
11
- * The resolved value of the promise
12
- *
13
- * @this {void}
14
- *
15
- * @param {unknown} value
16
- * The thing to check
17
- * @return {value is PromiseLike<T>}
18
- * `true` if `value` is {@linkcode PromiseLike}, `false` otherwise
19
- */
20
- declare function isPromise<T>(this: void, value: unknown): value is PromiseLike<T>;
21
- export default isPromise;
@@ -1 +0,0 @@
1
- var e=Object.defineProperty;var n=(t,o)=>e(t,"name",{value:o,configurable:!0});function f(t){return typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"}n(f,"isPromise");var r=f;export{r as default};
@@ -1,9 +0,0 @@
1
- /**
2
- * @file Internal - process/browser
3
- * @module mlly/internal/process/browser
4
- */
5
- declare const _default: {
6
- browser: boolean;
7
- platform: string;
8
- };
9
- export default _default;