@umijs/utils 4.0.0-beta.7 → 4.0.0-canary.202200505.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.
Files changed (64) hide show
  1. package/compiled/axios/index.d.ts +29 -14
  2. package/compiled/axios/index.js +1 -1
  3. package/compiled/chalk/LICENSE +1 -1
  4. package/compiled/chalk/index.js +1 -1
  5. package/compiled/chalk/package.json +1 -1
  6. package/compiled/chalk/source/index.d.ts +318 -0
  7. package/compiled/chalk/source/vendor/supports-color/index.d.ts +55 -0
  8. package/compiled/color/color-convert/conversions.d.ts +87 -87
  9. package/compiled/color/color-convert/index.d.ts +75 -60
  10. package/compiled/color/color-convert/route.d.ts +271 -271
  11. package/compiled/color/index.d.ts +118 -121
  12. package/compiled/color/index.js +1 -1
  13. package/compiled/color/package.json +1 -4
  14. package/compiled/debug/LICENSE +10 -9
  15. package/compiled/debug/index.js +1 -1
  16. package/compiled/debug/package.json +1 -1
  17. package/compiled/execa/index.d.ts +467 -445
  18. package/compiled/execa/index.js +1 -1
  19. package/compiled/fs-extra/index.d.ts +347 -116
  20. package/compiled/fs-extra/index.js +1 -1
  21. package/compiled/glob/LICENSE +1 -7
  22. package/compiled/glob/index.d.ts +3 -1
  23. package/compiled/glob/index.js +1 -1
  24. package/compiled/pirates/LICENSE +21 -0
  25. package/compiled/pirates/index.d.ts +82 -0
  26. package/compiled/pirates/index.js +1 -0
  27. package/compiled/pirates/package.json +1 -0
  28. package/compiled/pkg-up/LICENSE +1 -1
  29. package/compiled/pkg-up/index.d.ts +55 -44
  30. package/compiled/pkg-up/index.js +1 -1
  31. package/compiled/pkg-up/package.json +1 -1
  32. package/compiled/prettier/index.d.ts +568 -679
  33. package/compiled/prettier/index.js +62 -274
  34. package/compiled/prettier/package.json +1 -5
  35. package/compiled/resolve/index.js +1 -1
  36. package/compiled/semver/index.js +1 -1
  37. package/compiled/semver/package.json +1 -1
  38. package/compiled/strip-ansi/LICENSE +1 -1
  39. package/compiled/strip-ansi/index.d.ts +2 -4
  40. package/compiled/strip-ansi/index.js +1 -1
  41. package/compiled/strip-ansi/package.json +1 -1
  42. package/compiled/yargs-parser/index.js +1 -1
  43. package/dist/BaseGenerator/BaseGenerator.d.ts +2 -1
  44. package/dist/BaseGenerator/BaseGenerator.js +23 -32
  45. package/dist/BaseGenerator/generateFile.d.ts +2 -1
  46. package/dist/BaseGenerator/generateFile.js +4 -12
  47. package/dist/Generator/Generator.d.ts +3 -3
  48. package/dist/Generator/Generator.js +8 -21
  49. package/dist/getCorejsVersion.d.ts +1 -0
  50. package/dist/getCorejsVersion.js +11 -0
  51. package/dist/index.d.ts +6 -3
  52. package/dist/index.js +13 -6
  53. package/dist/installDeps.js +27 -5
  54. package/dist/isStyleFile.d.ts +5 -0
  55. package/dist/isStyleFile.js +16 -0
  56. package/dist/logger.d.ts +8 -6
  57. package/dist/logger.js +8 -1
  58. package/dist/npmClient.d.ts +3 -2
  59. package/dist/npmClient.js +20 -19
  60. package/dist/register.d.ts +1 -0
  61. package/dist/register.js +19 -22
  62. package/dist/tryPaths.d.ts +1 -0
  63. package/dist/tryPaths.js +11 -0
  64. package/package.json +38 -36
@@ -1,48 +1,59 @@
1
- declare namespace pkgUp {
2
- interface Options {
3
- /**
4
- Directory to start from.
5
-
6
- @default process.cwd()
7
- */
8
- readonly cwd?: string;
9
- }
10
- }
11
-
12
- declare const pkgUp: {
1
+ export interface Options {
13
2
  /**
14
- Find the closest `package.json` file.
15
-
16
- @returns The filepath, or `null` if it couldn't be found.
17
-
18
- @example
19
- ```
20
- // /
21
- // └── Users
22
- // └── sindresorhus
23
- // └── foo
24
- // ├── package.json
25
- // └── bar
26
- // ├── baz
27
- // └── example.js
28
-
29
- // example.js
30
- import pkgUp = require('../pkg-up');
31
-
32
- (async () => {
33
- console.log(await pkgUp());
34
- //=> '/Users/sindresorhus/foo/package.json'
35
- })();
36
- ```
37
- */
38
- (options?: pkgUp.Options): Promise<string | null>;
3
+ The directory to start from.
39
4
 
40
- /**
41
- Synchronously find the closest `package.json` file.
42
-
43
- @returns The filepath, or `null` if it couldn't be found.
5
+ @default process.cwd()
44
6
  */
45
- sync(options?: pkgUp.Options): string | null;
46
- };
7
+ readonly cwd?: string;
8
+ }
9
+
10
+ /**
11
+ Find the closest `package.json` file.
12
+
13
+ @returns The file path, or `undefined` if it could not be found.
14
+
15
+ @example
16
+ ```
17
+ // /
18
+ // └── Users
19
+ // └── sindresorhus
20
+ // └── foo
21
+ // ├── package.json
22
+ // └── bar
23
+ // ├── baz
24
+ // └── example.js
25
+
26
+ // example.js
27
+ import {pkgUp} from '../pkg-up';
28
+
29
+ console.log(await pkgUp());
30
+ //=> '/Users/sindresorhus/foo/package.json'
31
+ ```
32
+ */
33
+ export function pkgUp(options?: Options): Promise<string | undefined>;
34
+
35
+ /**
36
+ Synchronously find the closest `package.json` file.
37
+
38
+ @returns The file path, or `undefined` if it could not be found.
39
+
40
+ @example
41
+ ```
42
+ // /
43
+ // └── Users
44
+ // └── sindresorhus
45
+ // └── foo
46
+ // ├── package.json
47
+ // └── bar
48
+ // ├── baz
49
+ // └── example.js
50
+
51
+ // example.js
52
+ import {pkgUpSync} from '../pkg-up';
53
+
54
+ console.log(pkgUpSync());
55
+ //=> '/Users/sindresorhus/foo/package.json'
56
+ ```
57
+ */
58
+ export function pkgUpSync(options?: Options): string | undefined;
47
59
 
48
- export = pkgUp;
@@ -1 +1 @@
1
- (function(){"use strict";var e={555:function(e,r,n){const t=n(622);const s=n(326);e.exports=(e,r={})=>{const n=t.resolve(r.cwd||"");const{root:c}=t.parse(n);const o=[].concat(e);return new Promise((e=>{(function find(r){s(o,{cwd:r}).then((n=>{if(n){e(t.join(r,n))}else if(r===c){e(null)}else{find(t.dirname(r))}}))})(n)}))};e.exports.sync=(e,r={})=>{let n=t.resolve(r.cwd||"");const{root:c}=t.parse(n);const o=[].concat(e);while(true){const e=s.sync(o,{cwd:n});if(e){return t.join(n,e)}if(n===c){return null}n=t.dirname(n)}}},326:function(e,r,n){const t=n(622);const s=n(720);const c=n(463);e.exports=(e,r)=>{r=Object.assign({cwd:process.cwd()},r);return c(e,(e=>s(t.resolve(r.cwd,e))),r)};e.exports.sync=(e,r)=>{r=Object.assign({cwd:process.cwd()},r);for(const n of e){if(s.sync(t.resolve(r.cwd,n))){return n}}}},66:function(e,r,n){const t=n(502);const pLimit=e=>{if(!((Number.isInteger(e)||e===Infinity)&&e>0)){return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"))}const r=[];let n=0;const next=()=>{n--;if(r.length>0){r.shift()()}};const run=(e,r,...s)=>{n++;const c=t(e,...s);r(c);c.then(next,next)};const enqueue=(t,s,...c)=>{if(n<e){run(t,s,...c)}else{r.push(run.bind(null,t,s,...c))}};const generator=(e,...r)=>new Promise((n=>enqueue(e,n,...r)));Object.defineProperties(generator,{activeCount:{get:()=>n},pendingCount:{get:()=>r.length},clearQueue:{value:()=>{r.length=0}}});return generator};e.exports=pLimit;e.exports.default=pLimit},463:function(e,r,n){const t=n(66);class EndError extends Error{constructor(e){super();this.value=e}}const testElement=(e,r)=>Promise.resolve(e).then(r);const finder=e=>Promise.all(e).then((e=>e[1]===true&&Promise.reject(new EndError(e[0]))));e.exports=(e,r,n)=>{n=Object.assign({concurrency:Infinity,preserveOrder:true},n);const s=t(n.concurrency);const c=[...e].map((e=>[e,s(testElement,e,r)]));const o=t(n.preserveOrder?1:Infinity);return Promise.all(c.map((e=>o(finder,e)))).then((()=>{})).catch((e=>e instanceof EndError?e.value:Promise.reject(e)))}},502:function(e){const pTry=(e,...r)=>new Promise((n=>{n(e(...r))}));e.exports=pTry;e.exports.default=pTry},720:function(e,r,n){const t=n(747);e.exports=e=>new Promise((r=>{t.access(e,(e=>{r(!e)}))}));e.exports.sync=e=>{try{t.accessSync(e);return true}catch(e){return false}}},258:function(e,r,n){const t=n(555);e.exports=async({cwd:e}={})=>t("package.json",{cwd:e});e.exports.sync=({cwd:e}={})=>t.sync("package.json",{cwd:e})},747:function(e){e.exports=require("fs")},622:function(e){e.exports=require("path")}};var r={};function __nccwpck_require__(n){var t=r[n];if(t!==undefined){return t.exports}var s=r[n]={exports:{}};var c=true;try{e[n](s,s.exports,__nccwpck_require__);c=false}finally{if(c)delete r[n]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(258);module.exports=n})();
1
+ (function(){"use strict";var e={};!function(){e.d=function(t,n){for(var r in n){if(e.o(n,r)&&!e.o(t,r)){Object.defineProperty(t,r,{enumerable:true,get:n[r]})}}}}();!function(){e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}();!function(){e.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();if(typeof e!=="undefined")e.ab=__dirname+"/";var t={};e.r(t);e.d(t,{pkgUp:function(){return pkgUp},pkgUpSync:function(){return pkgUpSync}});var n=require("path");var r=require("url");var c=require("process");var i=require("fs");class Node{value;next;constructor(e){this.value=e}}class Queue{#e;#t;#n;constructor(){this.clear()}enqueue(e){const t=new Node(e);if(this.#e){this.#t.next=t;this.#t=t}else{this.#e=t;this.#t=t}this.#n++}dequeue(){const e=this.#e;if(!e){return}this.#e=this.#e.next;this.#n--;return e.value}clear(){this.#e=undefined;this.#t=undefined;this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;while(e){yield e.value;e=e.next}}}function pLimit(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0)){throw new TypeError("Expected `concurrency` to be a number from 1 and up")}const t=new Queue;let n=0;const next=()=>{n--;if(t.size>0){t.dequeue()()}};const run=async(e,t,r)=>{n++;const c=(async()=>e(...r))();t(c);try{await c}catch{}next()};const enqueue=(r,c,i)=>{t.enqueue(run.bind(undefined,r,c,i));(async()=>{await Promise.resolve();if(n<e&&t.size>0){t.dequeue()()}})()};const generator=(e,...t)=>new Promise((n=>{enqueue(e,n,t)}));Object.defineProperties(generator,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}});return generator}class EndError extends Error{constructor(e){super();this.value=e}}const testElement=async(e,t)=>t(await e);const finder=async e=>{const t=await Promise.all(e);if(t[1]===true){throw new EndError(t[0])}return false};async function pLocate(e,t,{concurrency:n=Number.POSITIVE_INFINITY,preserveOrder:r=true}={}){const c=pLimit(n);const i=[...e].map((e=>[e,c(testElement,e,t)]));const o=pLimit(r?1:Number.POSITIVE_INFINITY);try{await Promise.all(i.map((e=>o(finder,e))))}catch(e){if(e instanceof EndError){return e.value}throw e}}const o={directory:"isDirectory",file:"isFile"};function checkType(e){if(e in o){return}throw new Error(`Invalid type specified: ${e}`)}const matchType=(e,t)=>e===undefined||t[o[e]]();const toPath=e=>e instanceof URL?(0,r.fileURLToPath)(e):e;async function locatePath(e,{cwd:t=c.cwd(),type:r="file",allowSymlinks:o=true,concurrency:s,preserveOrder:a}={}){checkType(r);t=toPath(t);const u=o?i.promises.stat:i.promises.lstat;return pLocate(e,(async e=>{try{const c=await u(n.resolve(t,e));return matchType(r,c)}catch{return false}}),{concurrency:s,preserveOrder:a})}function locatePathSync(e,{cwd:t=c.cwd(),type:r="file",allowSymlinks:o=true}={}){checkType(r);t=toPath(t);const s=o?i.statSync:i.lstatSync;for(const c of e){try{const e=s(n.resolve(t,c));if(matchType(r,e)){return c}}catch{}}}async function pathExists(e){try{await fsPromises.access(e);return true}catch{return false}}function pathExistsSync(e){try{fs.accessSync(e);return true}catch{return false}}const find_up_toPath=e=>e instanceof URL?(0,r.fileURLToPath)(e):e;const s=Symbol("findUpStop");async function findUpMultiple(e,t={}){let r=n.resolve(find_up_toPath(t.cwd)||"");const{root:c}=n.parse(r);const i=n.resolve(r,t.stopAt||c);const o=t.limit||Number.POSITIVE_INFINITY;const a=[e].flat();const runMatcher=async t=>{if(typeof e!=="function"){return locatePath(a,t)}const n=await e(t.cwd);if(typeof n==="string"){return locatePath([n],t)}return n};const u=[];while(true){const e=await runMatcher({...t,cwd:r});if(e===s){break}if(e){u.push(n.resolve(r,e))}if(r===i||u.length>=o){break}r=n.dirname(r)}return u}function findUpMultipleSync(e,t={}){let r=n.resolve(find_up_toPath(t.cwd)||"");const{root:c}=n.parse(r);const i=t.stopAt||c;const o=t.limit||Number.POSITIVE_INFINITY;const a=[e].flat();const runMatcher=t=>{if(typeof e!=="function"){return locatePathSync(a,t)}const n=e(t.cwd);if(typeof n==="string"){return locatePathSync([n],t)}return n};const u=[];while(true){const e=runMatcher({...t,cwd:r});if(e===s){break}if(e){u.push(n.resolve(r,e))}if(r===i||u.length>=o){break}r=n.dirname(r)}return u}async function findUp(e,t={}){const n=await findUpMultiple(e,{...t,limit:1});return n[0]}function findUpSync(e,t={}){const n=findUpMultipleSync(e,{...t,limit:1});return n[0]}async function pkgUp({cwd:e}={}){return findUp("package.json",{cwd:e})}function pkgUpSync({cwd:e}={}){return findUpSync("package.json",{cwd:e})}module.exports=t})();
@@ -1 +1 @@
1
- {"name":"pkg-up","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"license":"MIT"}
1
+ {"name":"pkg-up","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT"}