@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.
- package/compiled/axios/index.d.ts +29 -14
- package/compiled/axios/index.js +1 -1
- package/compiled/chalk/LICENSE +1 -1
- package/compiled/chalk/index.js +1 -1
- package/compiled/chalk/package.json +1 -1
- package/compiled/chalk/source/index.d.ts +318 -0
- package/compiled/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/compiled/color/color-convert/conversions.d.ts +87 -87
- package/compiled/color/color-convert/index.d.ts +75 -60
- package/compiled/color/color-convert/route.d.ts +271 -271
- package/compiled/color/index.d.ts +118 -121
- package/compiled/color/index.js +1 -1
- package/compiled/color/package.json +1 -4
- package/compiled/debug/LICENSE +10 -9
- package/compiled/debug/index.js +1 -1
- package/compiled/debug/package.json +1 -1
- package/compiled/execa/index.d.ts +467 -445
- package/compiled/execa/index.js +1 -1
- package/compiled/fs-extra/index.d.ts +347 -116
- package/compiled/fs-extra/index.js +1 -1
- package/compiled/glob/LICENSE +1 -7
- package/compiled/glob/index.d.ts +3 -1
- package/compiled/glob/index.js +1 -1
- package/compiled/pirates/LICENSE +21 -0
- package/compiled/pirates/index.d.ts +82 -0
- package/compiled/pirates/index.js +1 -0
- package/compiled/pirates/package.json +1 -0
- package/compiled/pkg-up/LICENSE +1 -1
- package/compiled/pkg-up/index.d.ts +55 -44
- package/compiled/pkg-up/index.js +1 -1
- package/compiled/pkg-up/package.json +1 -1
- package/compiled/prettier/index.d.ts +568 -679
- package/compiled/prettier/index.js +62 -274
- package/compiled/prettier/package.json +1 -5
- package/compiled/resolve/index.js +1 -1
- package/compiled/semver/index.js +1 -1
- package/compiled/semver/package.json +1 -1
- package/compiled/strip-ansi/LICENSE +1 -1
- package/compiled/strip-ansi/index.d.ts +2 -4
- package/compiled/strip-ansi/index.js +1 -1
- package/compiled/strip-ansi/package.json +1 -1
- package/compiled/yargs-parser/index.js +1 -1
- package/dist/BaseGenerator/BaseGenerator.d.ts +2 -1
- package/dist/BaseGenerator/BaseGenerator.js +23 -32
- package/dist/BaseGenerator/generateFile.d.ts +2 -1
- package/dist/BaseGenerator/generateFile.js +4 -12
- package/dist/Generator/Generator.d.ts +3 -3
- package/dist/Generator/Generator.js +8 -21
- package/dist/getCorejsVersion.d.ts +1 -0
- package/dist/getCorejsVersion.js +11 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +13 -6
- package/dist/installDeps.js +27 -5
- package/dist/isStyleFile.d.ts +5 -0
- package/dist/isStyleFile.js +16 -0
- package/dist/logger.d.ts +8 -6
- package/dist/logger.js +8 -1
- package/dist/npmClient.d.ts +3 -2
- package/dist/npmClient.js +20 -19
- package/dist/register.d.ts +1 -0
- package/dist/register.js +19 -22
- package/dist/tryPaths.d.ts +1 -0
- package/dist/tryPaths.js +11 -0
- package/package.json +38 -36
|
@@ -1,48 +1,59 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
package/compiled/pkg-up/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var e={
|
|
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"}
|