-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'SukkaW:master' into es6-promise
- Loading branch information
Showing
34 changed files
with
1,568 additions
and
1,738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "nolyfill-monorepo", | ||
"version": "1.0.39", | ||
"version": "1.0.41", | ||
"private": true, | ||
"files": [], | ||
"scripts": { | ||
|
@@ -12,29 +12,28 @@ | |
"release": "bumpp --all --commit \"release: %s\" --tag \"%s\"" | ||
}, | ||
"devDependencies": { | ||
"@eslint-sukka/node": "^6.1.6", | ||
"@eslint-sukka/ts": "^5.1.2", | ||
"@eslint-sukka/node": "^6.7.0", | ||
"@jsdevtools/ez-spawn": "^3.0.4", | ||
"@nolyfill/internal": "workspace:*", | ||
"@package-json/types": "^0.0.11", | ||
"@swc-node/register": "^1.10.9", | ||
"@swc/core": "^1.7.0", | ||
"@types/node": "^20.14.11", | ||
"@swc/core": "^1.7.36", | ||
"@types/node": "^20.16.11", | ||
"bumpp": "^9.4.1", | ||
"dequal": "2.0.3", | ||
"eslint": "^9.7.0", | ||
"eslint-config-sukka": "^6.1.6", | ||
"eslint-formatter-sukka": "^6.1.6", | ||
"path-scurry": "^1.11.1", | ||
"picocolors": "^1.0.1", | ||
"eslint": "^9.12.0", | ||
"eslint-config-sukka": "^6.7.0", | ||
"eslint-formatter-sukka": "^6.7.0", | ||
"path-scurry": "^2.0.0", | ||
"picocolors": "^1.1.0", | ||
"rimraf": "^6.0.1", | ||
"rollup": "^4.19.0", | ||
"rollup": "^4.24.0", | ||
"rollup-plugin-dts": "^6.1.1", | ||
"rollup-plugin-swc3": "^0.11.2", | ||
"turbo": "^2.0.9", | ||
"type-fest": "^4.22.1", | ||
"typescript": "^5.5.3" | ||
"rollup-plugin-swc3": "^0.12.1", | ||
"turbo": "^2.1.3", | ||
"typescript": "^5.6.3" | ||
}, | ||
"packageManager": "pnpm@9.5.0", | ||
"packageManager": "pnpm@9.12.1", | ||
"engines": { | ||
"node": ">=16.8.0" | ||
}, | ||
|
@@ -146,13 +145,13 @@ | |
"which-typed-array": "workspace:@nolyfill/which-typed-array@*" | ||
}, | ||
"patchedDependencies": { | ||
"@types/[email protected]": "patches/@[email protected]", | ||
"@npmcli/[email protected]": "patches/@[email protected]", | ||
"[email protected]": "patches/[email protected]", | ||
"@yarnpkg/[email protected]": "patches/@[email protected]", | ||
"@pnpm/[email protected]": "patches/@[email protected]", | ||
"@pnpm/[email protected]": "patches/@[email protected]", | ||
"@pnpm/[email protected]": "patches/@[email protected]" | ||
"@pnpm/[email protected]": "patches/@[email protected]", | ||
"@pnpm/[email protected]": "patches/@[email protected]", | ||
"@yarnpkg/parsers": "patches/@yarnpkg__parsers.patch", | ||
"@npmcli/arborist": "patches/@npmcli__arborist.patch", | ||
"@types/npmcli__arborist": "patches/@types__npmcli__arborist.patch" | ||
} | ||
}, | ||
"overrides": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { defineEsShim } from '@nolyfill/shared'; | ||
|
||
export default defineEsShim(Function.prototype.name); | ||
export default defineEsShim<Function, (this: Function) => string>(function functionPrototypeName() { return this.name; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export default Buffer; | ||
// eslint-disable-next-line n/no-deprecated-api -- ignore deprecation | ||
export * from 'node:buffer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export default Buffer; | ||
// eslint-disable-next-line n/no-deprecated-api -- ignore deprecation | ||
export * from 'node:buffer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e}});const e=(0,require("@nolyfill/shared").defineEsShim)(Function.prototype.name); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e}});const e=(0,require("@nolyfill/shared").defineEsShim)(function(){return this.name}); | ||
Object.assign(exports.default, exports); module.exports = exports.default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,12 @@ | ||
import path from 'path'; | ||
import fs, { type PathLike } from 'fs'; | ||
import fsp from 'fs/promises'; | ||
|
||
import { fileExists } from '@nolyfill/internal'; | ||
|
||
import PromiseAny from '@nolyfill/promise.any'; | ||
import { detect, type DetectResult } from 'package-manager-detector'; | ||
|
||
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'; | ||
|
||
const checkFile = (path: PathLike) => fsp.access(path, fs.constants.F_OK); | ||
|
||
export async function detectPackageManager(projectPath: string): Promise<PackageManager> { | ||
const packageJsonPath = path.join(projectPath, 'package.json'); | ||
|
||
if (!await fileExists(packageJsonPath)) { | ||
throw new Error(`Failed to locate package.json at ${projectPath}. Are you sure the path is correct?`); | ||
} | ||
|
||
try { | ||
return await PromiseAny([ | ||
checkFile(path.join(projectPath, 'yarn.lock')).then<'yarn'>(() => 'yarn'), | ||
checkFile(path.join(projectPath, 'pnpm-lock.yaml')).then<'pnpm'>(() => 'pnpm'), | ||
checkFile(path.join(projectPath, 'package-lock.json')).then<'npm'>(() => 'npm'), | ||
checkFile(path.join(projectPath, 'npm-shrinkwrap.json')).then<'npm'>(() => 'npm'), | ||
checkFile(path.join(projectPath, 'bun.lockb')).then<'bun'>(() => 'bun') | ||
]); | ||
} catch (e) { | ||
console.log(e); | ||
throw new Error('Can not determine the preferred package manager.'); | ||
export function tramsformPackageManager(input: DetectResult | null): PackageManager { | ||
if (input == null) { | ||
throw new Error('Can not determine the preferred package manager'); | ||
} | ||
return input.agent.split('@')[0] as PackageManager; | ||
} | ||
|
||
export const detectPackageManager = (cwd: string) => detect({ cwd }).then(tramsformPackageManager); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.