@socketsecurity/lib 5.18.2 → 5.19.0
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 +43 -0
- package/README.md +6 -5
- package/dist/abort.d.ts +3 -0
- package/dist/abort.js +1 -0
- package/dist/agent.d.ts +66 -49
- package/dist/agent.js +51 -50
- package/dist/ansi.d.ts +2 -5
- package/dist/ansi.js +3 -2
- package/dist/archives.d.ts +25 -21
- package/dist/archives.js +35 -34
- package/dist/argv/flags.d.ts +100 -91
- package/dist/argv/flags.js +88 -87
- package/dist/argv/parse.d.ts +30 -40
- package/dist/argv/parse.js +33 -32
- package/dist/arrays.d.ts +4 -8
- package/dist/arrays.js +1 -0
- package/dist/bin.d.ts +7 -5
- package/dist/bin.js +52 -29
- package/dist/cacache.d.ts +13 -12
- package/dist/cacache.js +9 -8
- package/dist/cache-with-ttl.d.ts +53 -35
- package/dist/cache-with-ttl.js +1 -0
- package/dist/colors.d.ts +5 -5
- package/dist/colors.js +1 -0
- package/dist/constants/agents.d.ts +5 -9
- package/dist/constants/agents.js +3 -2
- package/dist/constants/core.d.ts +5 -10
- package/dist/constants/core.js +2 -1
- package/dist/constants/encoding.d.ts +3 -3
- package/dist/constants/encoding.js +1 -0
- package/dist/constants/github.d.ts +3 -3
- package/dist/constants/github.js +1 -0
- package/dist/constants/licenses.d.ts +9 -2
- package/dist/constants/licenses.js +1 -0
- package/dist/constants/lifecycle-script-names.js +1 -0
- package/dist/constants/maintained-node-versions.d.ts +3 -0
- package/dist/constants/maintained-node-versions.js +1 -0
- package/dist/constants/node.d.ts +125 -16
- package/dist/constants/node.js +74 -73
- package/dist/constants/package-default-node-range.d.ts +3 -1
- package/dist/constants/package-default-node-range.js +2 -1
- package/dist/constants/package-default-socket-categories.d.ts +0 -1
- package/dist/constants/package-default-socket-categories.js +1 -0
- package/dist/constants/packages.d.ts +12 -17
- package/dist/constants/packages.js +31 -16
- package/dist/constants/platform.d.ts +1 -2
- package/dist/constants/platform.js +2 -1
- package/dist/constants/process.d.ts +18 -0
- package/dist/constants/process.js +1 -0
- package/dist/constants/socket.d.ts +4 -10
- package/dist/constants/socket.js +2 -1
- package/dist/constants/testing.d.ts +3 -3
- package/dist/constants/testing.js +1 -0
- package/dist/constants/time.d.ts +3 -4
- package/dist/constants/time.js +1 -0
- package/dist/constants/typescript.d.ts +10 -3
- package/dist/constants/typescript.js +5 -4
- package/dist/cover/code.d.ts +3 -0
- package/dist/cover/code.js +12 -12
- package/dist/cover/formatters.d.ts +12 -9
- package/dist/cover/formatters.js +19 -18
- package/dist/cover/type.d.ts +3 -0
- package/dist/cover/type.js +1 -0
- package/dist/cover/types.js +1 -0
- package/dist/debug.d.ts +32 -47
- package/dist/debug.js +97 -96
- package/dist/dlx/arborist.d.ts +134 -0
- package/dist/dlx/arborist.js +177 -0
- package/dist/dlx/binary.d.ts +25 -9
- package/dist/dlx/binary.js +34 -12
- package/dist/dlx/cache.d.ts +1 -0
- package/dist/dlx/cache.js +2 -1
- package/dist/dlx/detect.d.ts +15 -0
- package/dist/dlx/detect.js +28 -20
- package/dist/dlx/dir.d.ts +1 -11
- package/dist/dlx/dir.js +2 -12
- package/dist/dlx/integrity.d.ts +86 -0
- package/dist/dlx/integrity.js +112 -0
- package/dist/dlx/lockfile.d.ts +115 -0
- package/dist/dlx/lockfile.js +139 -0
- package/dist/dlx/manifest.d.ts +26 -1
- package/dist/dlx/manifest.js +9 -6
- package/dist/dlx/package.d.ts +58 -3
- package/dist/dlx/package.js +101 -74
- package/dist/dlx/packages.d.ts +1 -11
- package/dist/dlx/packages.js +3 -14
- package/dist/dlx/paths.d.ts +1 -0
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +1 -0
- package/dist/effects/text-shimmer.d.ts +13 -2
- package/dist/effects/text-shimmer.js +50 -46
- package/dist/effects/types.js +1 -0
- package/dist/effects/ultra.js +1 -0
- package/dist/env/ci.d.ts +6 -1
- package/dist/env/ci.js +1 -0
- package/dist/env/debug.d.ts +5 -1
- package/dist/env/debug.js +1 -0
- package/dist/env/github.d.ts +19 -23
- package/dist/env/github.js +5 -4
- package/dist/env/helpers.d.ts +21 -9
- package/dist/env/helpers.js +5 -11
- package/dist/env/home.d.ts +17 -4
- package/dist/env/home.js +2 -1
- package/dist/env/locale.d.ts +4 -3
- package/dist/env/locale.js +1 -0
- package/dist/env/node-auth-token.d.ts +5 -1
- package/dist/env/node-auth-token.js +1 -0
- package/dist/env/node-env.d.ts +5 -1
- package/dist/env/node-env.js +1 -0
- package/dist/env/npm.d.ts +4 -5
- package/dist/env/npm.js +1 -0
- package/dist/env/package-manager.d.ts +4 -3
- package/dist/env/package-manager.js +2 -1
- package/dist/env/path.d.ts +5 -1
- package/dist/env/path.js +1 -0
- package/dist/env/pre-commit.d.ts +5 -1
- package/dist/env/pre-commit.js +1 -0
- package/dist/env/rewire.d.ts +10 -0
- package/dist/env/rewire.js +7 -5
- package/dist/env/shell.d.ts +5 -1
- package/dist/env/shell.js +1 -0
- package/dist/env/socket-cli-shadow.d.ts +4 -5
- package/dist/env/socket-cli-shadow.js +1 -0
- package/dist/env/socket-cli.d.ts +4 -14
- package/dist/env/socket-cli.js +1 -0
- package/dist/env/socket.d.ts +6 -18
- package/dist/env/socket.js +4 -3
- package/dist/env/temp-dir.d.ts +4 -3
- package/dist/env/temp-dir.js +1 -0
- package/dist/env/term.d.ts +5 -1
- package/dist/env/term.js +1 -0
- package/dist/env/test.d.ts +4 -3
- package/dist/env/test.js +1 -0
- package/dist/env/windows.d.ts +4 -4
- package/dist/env/windows.js +1 -0
- package/dist/env/xdg.d.ts +4 -3
- package/dist/env/xdg.js +1 -0
- package/dist/env.d.ts +83 -23
- package/dist/env.js +112 -80
- package/dist/errors.js +1 -0
- package/dist/external/@npmcli/package-json.js +9 -3968
- package/dist/external/@socketregistry/packageurl-js.js +2 -2
- package/dist/external/debug.js +162 -328
- package/dist/external/external-pack.js +3 -2835
- package/dist/external/npm-pack.js +13939 -33342
- package/dist/external/zod.js +160 -7558
- package/dist/fs.d.ts +92 -113
- package/dist/fs.js +35 -35
- package/dist/git.d.ts +170 -164
- package/dist/git.js +113 -87
- package/dist/github.d.ts +249 -227
- package/dist/github.js +82 -81
- package/dist/globs.d.ts +31 -17
- package/dist/globs.js +51 -58
- package/dist/http-request.d.ts +99 -99
- package/dist/http-request.js +182 -156
- package/dist/ipc-cli.d.ts +28 -0
- package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
- package/dist/ipc.d.ts +9 -299
- package/dist/ipc.js +18 -204
- package/dist/json/edit.d.ts +3 -1
- package/dist/json/edit.js +30 -30
- package/dist/json/format.d.ts +36 -36
- package/dist/json/format.js +22 -21
- package/dist/json/parse.d.ts +4 -2
- package/dist/json/parse.js +1 -0
- package/dist/json/types.js +1 -0
- package/dist/{links/index.d.ts → links.d.ts} +6 -2
- package/dist/{links/index.js → links.js} +5 -4
- package/dist/logger.d.ts +4 -6
- package/dist/logger.js +61 -53
- package/dist/memoization.d.ts +52 -49
- package/dist/memoization.js +55 -33
- package/dist/objects.d.ts +25 -44
- package/dist/objects.js +2 -1
- package/dist/package-extensions.d.ts +6 -0
- package/dist/package-extensions.js +2 -1
- package/dist/packages/edit.d.ts +3 -5
- package/dist/packages/edit.js +4 -3
- package/dist/packages/exports.d.ts +11 -14
- package/dist/packages/exports.js +11 -10
- package/dist/packages/isolation.d.ts +4 -0
- package/dist/packages/isolation.js +20 -19
- package/dist/packages/licenses.d.ts +3 -10
- package/dist/packages/licenses.js +2 -1
- package/dist/packages/manifest.d.ts +3 -3
- package/dist/packages/manifest.js +1 -0
- package/dist/packages/normalize.d.ts +3 -4
- package/dist/packages/normalize.js +1 -0
- package/dist/packages/operations.d.ts +3 -10
- package/dist/packages/operations.js +1 -0
- package/dist/packages/provenance.d.ts +10 -8
- package/dist/packages/provenance.js +55 -54
- package/dist/packages/specs.d.ts +3 -5
- package/dist/packages/specs.js +1 -0
- package/dist/packages/validation.d.ts +3 -3
- package/dist/packages/validation.js +1 -0
- package/dist/packages.d.ts +2 -17
- package/dist/packages.js +2 -1
- package/dist/paths/dirnames.d.ts +0 -2
- package/dist/paths/dirnames.js +1 -0
- package/dist/paths/exts.d.ts +0 -1
- package/dist/paths/exts.js +1 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +1 -0
- package/dist/paths/globs.d.ts +0 -1
- package/dist/paths/globs.js +1 -0
- package/dist/paths/normalize.d.ts +115 -123
- package/dist/paths/normalize.js +128 -127
- package/dist/paths/packages.d.ts +3 -2
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.d.ts +9 -0
- package/dist/paths/rewire.js +5 -3
- package/dist/paths/socket.d.ts +37 -23
- package/dist/paths/socket.js +26 -25
- package/dist/performance.d.ts +87 -84
- package/dist/performance.js +97 -96
- package/dist/process-lock.d.ts +41 -1
- package/dist/process-lock.js +24 -17
- package/dist/promise-queue.d.ts +6 -0
- package/dist/promise-queue.js +1 -0
- package/dist/promises.d.ts +40 -55
- package/dist/promises.js +12 -11
- package/dist/regexps.d.ts +0 -5
- package/dist/regexps.js +1 -0
- package/dist/releases/github.d.ts +59 -63
- package/dist/releases/github.js +95 -100
- package/dist/releases/socket-btm.d.ts +9 -2
- package/dist/releases/socket-btm.js +32 -25
- package/dist/sea.d.ts +5 -0
- package/dist/sea.js +1 -0
- package/dist/shadow.d.ts +4 -0
- package/dist/shadow.js +1 -0
- package/dist/signal-exit.d.ts +7 -7
- package/dist/signal-exit.js +46 -45
- package/dist/sorts.d.ts +5 -7
- package/dist/sorts.js +11 -10
- package/dist/spawn.d.ts +96 -77
- package/dist/spawn.js +39 -38
- package/dist/spinner.d.ts +21 -22
- package/dist/spinner.js +15 -11
- package/dist/ssri.d.ts +31 -36
- package/dist/ssri.js +15 -14
- package/dist/stdio/_stream.d.ts +31 -0
- package/dist/stdio/_stream.js +57 -0
- package/dist/stdio/divider.d.ts +40 -36
- package/dist/stdio/divider.js +10 -9
- package/dist/stdio/footer.d.ts +20 -0
- package/dist/stdio/footer.js +12 -2
- package/dist/stdio/header.d.ts +4 -16
- package/dist/stdio/header.js +1 -9
- package/dist/stdio/stderr.d.ts +51 -39
- package/dist/stdio/stderr.js +19 -22
- package/dist/stdio/stdout.d.ts +54 -52
- package/dist/stdio/stdout.js +35 -33
- package/dist/streams.d.ts +4 -3
- package/dist/streams.js +1 -0
- package/dist/strings.d.ts +31 -85
- package/dist/strings.js +5 -49
- package/dist/suppress-warnings.d.ts +32 -15
- package/dist/suppress-warnings.js +14 -13
- package/dist/tables.d.ts +30 -26
- package/dist/tables.js +24 -23
- package/dist/temporary-executor.d.ts +4 -0
- package/dist/temporary-executor.js +1 -0
- package/dist/themes/context.d.ts +30 -26
- package/dist/themes/context.js +19 -18
- package/dist/themes/index.d.ts +0 -4
- package/dist/themes/index.js +1 -0
- package/dist/themes/themes.d.ts +1 -1
- package/dist/themes/themes.js +1 -0
- package/dist/themes/types.js +1 -0
- package/dist/themes/utils.d.ts +46 -43
- package/dist/themes/utils.js +45 -44
- package/dist/types.d.ts +48 -52
- package/dist/types.js +35 -35
- package/dist/url.d.ts +48 -53
- package/dist/url.js +38 -37
- package/dist/validation/json-parser.d.ts +19 -190
- package/dist/validation/json-parser.js +5 -69
- package/dist/validation/types.d.ts +9 -33
- package/dist/validation/types.js +1 -0
- package/dist/versions.d.ts +1 -0
- package/dist/versions.js +2 -1
- package/dist/words.d.ts +3 -6
- package/dist/words.js +1 -0
- package/dist/zod.js +1 -0
- package/package.json +34 -66
- package/dist/external/@inquirer/checkbox.js +0 -5
- package/dist/external/@inquirer/confirm.js +0 -5
- package/dist/external/@inquirer/input.js +0 -5
- package/dist/external/@inquirer/password.js +0 -5
- package/dist/external/@inquirer/search.js +0 -5
- package/dist/external/@inquirer/select.js +0 -5
- package/dist/functions.d.ts +0 -57
- package/dist/functions.js +0 -70
- package/dist/stdio/clear.d.ts +0 -140
- package/dist/stdio/clear.js +0 -95
- package/dist/stdio/mask.d.ts +0 -151
- package/dist/stdio/mask.js +0 -224
- package/dist/stdio/progress.d.ts +0 -148
- package/dist/stdio/progress.js +0 -212
- package/dist/stdio/prompts.d.ts +0 -195
- package/dist/stdio/prompts.js +0 -176
- package/dist/utils/get-ipc.d.ts +0 -15
package/dist/packages.d.ts
CHANGED
|
@@ -10,15 +10,13 @@ import { collectIncompatibleLicenses, collectLicenseWarnings, createAstNode, cre
|
|
|
10
10
|
import { createPackageJson, fetchPackageManifest, fetchPackagePackument } from './packages/manifest';
|
|
11
11
|
import { normalizePackageJson, resolveEscapedScope, resolveOriginalPackageName, unescapeScope } from './packages/normalize';
|
|
12
12
|
import { extractPackage, findPackageExtensions, getReleaseTag, packPackage, readPackageJson, readPackageJsonSync, resolveGitHubTgzUrl, resolvePackageName, resolveRegistryPackageName } from './packages/operations';
|
|
13
|
-
import { resolvePackageJsonDirname, resolvePackageJsonPath } from './paths/packages';
|
|
14
13
|
import { fetchPackageProvenance, getProvenanceDetails } from './packages/provenance';
|
|
15
14
|
import { getRepoUrlDetails, gitHubTagRefUrl, gitHubTgzUrl, isGitHubTgzSpec, isGitHubUrlSpec } from './packages/specs';
|
|
16
15
|
import { isBlessedPackageName, isRegistryFetcherType, isValidPackageName } from './packages/validation';
|
|
17
|
-
|
|
16
|
+
import { resolvePackageJsonDirname, resolvePackageJsonPath } from './paths/packages';
|
|
18
17
|
type PackageExports = {
|
|
19
18
|
[path: string]: unknown;
|
|
20
19
|
};
|
|
21
|
-
// Re-export the EditablePackageJson instance type for convenient access
|
|
22
20
|
export type EditablePackageJson = import('./packages/edit').EditablePackageJsonInstance;
|
|
23
21
|
/**
|
|
24
22
|
* Extended PackageJson type based on NPMCliPackageJson.Content with Socket-specific additions.
|
|
@@ -26,7 +24,6 @@ export type EditablePackageJson = import('./packages/edit').EditablePackageJsonI
|
|
|
26
24
|
* @property socket - Optional Socket.dev specific configuration
|
|
27
25
|
*/
|
|
28
26
|
export type PackageJson = {
|
|
29
|
-
// Core npm fields
|
|
30
27
|
[key: string]: unknown;
|
|
31
28
|
name?: string | undefined;
|
|
32
29
|
version?: string | undefined;
|
|
@@ -36,7 +33,6 @@ export type PackageJson = {
|
|
|
36
33
|
types?: string | undefined;
|
|
37
34
|
typings?: string | undefined;
|
|
38
35
|
bin?: string | Record<string, string> | undefined;
|
|
39
|
-
// Author and contributors
|
|
40
36
|
author?: string | {
|
|
41
37
|
name?: string;
|
|
42
38
|
email?: string;
|
|
@@ -52,7 +48,6 @@ export type PackageJson = {
|
|
|
52
48
|
email?: string;
|
|
53
49
|
url?: string;
|
|
54
50
|
}> | undefined;
|
|
55
|
-
// Repository and URLs
|
|
56
51
|
repository?: string | {
|
|
57
52
|
type?: string;
|
|
58
53
|
url?: string;
|
|
@@ -63,44 +58,34 @@ export type PackageJson = {
|
|
|
63
58
|
url?: string;
|
|
64
59
|
email?: string;
|
|
65
60
|
} | undefined;
|
|
66
|
-
// License
|
|
67
61
|
license?: string | undefined;
|
|
68
62
|
licenses?: Array<{
|
|
69
63
|
type?: string;
|
|
70
64
|
url?: string;
|
|
71
65
|
}> | undefined;
|
|
72
|
-
// Scripts
|
|
73
66
|
scripts?: Record<string, string> | undefined;
|
|
74
|
-
// Dependencies
|
|
75
67
|
dependencies?: Record<string, string> | undefined;
|
|
76
68
|
devDependencies?: Record<string, string> | undefined;
|
|
77
69
|
peerDependencies?: Record<string, string> | undefined;
|
|
78
70
|
optionalDependencies?: Record<string, string> | undefined;
|
|
79
71
|
bundledDependencies?: string[] | undefined;
|
|
80
72
|
bundleDependencies?: string[] | undefined;
|
|
81
|
-
// Package managers specific
|
|
82
73
|
overrides?: Record<string, string> | undefined;
|
|
83
74
|
resolutions?: Record<string, string> | undefined;
|
|
84
75
|
pnpm?: Record<string, unknown> | undefined;
|
|
85
|
-
// Module system
|
|
86
76
|
exports?: PackageExports | string | string[] | undefined;
|
|
87
77
|
imports?: Record<string, unknown> | undefined;
|
|
88
78
|
type?: 'module' | 'commonjs' | undefined;
|
|
89
|
-
// Publishing
|
|
90
79
|
private?: boolean | undefined;
|
|
91
80
|
publishConfig?: Record<string, unknown> | undefined;
|
|
92
81
|
files?: string[] | undefined;
|
|
93
|
-
// Engines and OS
|
|
94
82
|
engines?: Record<string, string> | undefined;
|
|
95
83
|
os?: string[] | undefined;
|
|
96
84
|
cpu?: string[] | undefined;
|
|
97
|
-
// Package manager
|
|
98
85
|
packageManager?: string | undefined;
|
|
99
|
-
// Workspaces
|
|
100
86
|
workspaces?: string[] | {
|
|
101
87
|
packages?: string[];
|
|
102
88
|
} | undefined;
|
|
103
|
-
// Socket.dev specific
|
|
104
89
|
socket?: {
|
|
105
90
|
categories?: CategoryString | CategoryString[];
|
|
106
91
|
interop?: string | string[];
|
|
@@ -151,4 +136,4 @@ export type PacoteOptions = {
|
|
|
151
136
|
};
|
|
152
137
|
export type { IsolatePackageOptions, IsolatePackageResult, } from './packages/isolation';
|
|
153
138
|
export type { InternalAstNode, InternalBinaryOperationNode, InternalLicenseNode, LicenseVisitor, SpdxAstNode, SpdxBinaryOperationNode, SpdxLicenseNode, } from './packages/licenses';
|
|
154
|
-
export { collectIncompatibleLicenses, collectLicenseWarnings, createAstNode, createBinaryOperationNode, createLicenseNode, createPackageJson, extractPackage, fetchPackageManifest, fetchPackagePackument, fetchPackageProvenance, findPackageExtensions, findTypesForSubpath, getEditablePackageJsonClass, getExportFilePaths, getProvenanceDetails, getReleaseTag, getRepoUrlDetails, getSubpaths, gitHubTagRefUrl, gitHubTgzUrl, isBlessedPackageName, isConditionalExports, isGitHubTgzSpec, isGitHubUrlSpec, isolatePackage, isRegistryFetcherType, isSubpathExports, isValidPackageName, normalizePackageJson, packPackage, parseSpdxExp, pkgJsonToEditable, readPackageJson, readPackageJsonSync, resolveEscapedScope, resolveGitHubTgzUrl, resolveOriginalPackageName,
|
|
139
|
+
export { collectIncompatibleLicenses, collectLicenseWarnings, createAstNode, createBinaryOperationNode, createLicenseNode, createPackageJson, extractPackage, fetchPackageManifest, fetchPackagePackument, fetchPackageProvenance, findPackageExtensions, findTypesForSubpath, getEditablePackageJsonClass, getExportFilePaths, getProvenanceDetails, getReleaseTag, getRepoUrlDetails, getSubpaths, gitHubTagRefUrl, gitHubTgzUrl, isBlessedPackageName, isConditionalExports, isGitHubTgzSpec, isGitHubUrlSpec, isolatePackage, isRegistryFetcherType, isSubpathExports, isValidPackageName, normalizePackageJson, packPackage, parseSpdxExp, pkgJsonToEditable, readPackageJson, readPackageJsonSync, resolveEscapedScope, resolveGitHubTgzUrl, resolveOriginalPackageName, resolvePackageJsonDirname, resolvePackageJsonEntryExports, resolvePackageJsonPath, resolvePackageLicenses, resolvePackageName, resolveRegistryPackageName, toEditablePackageJson, toEditablePackageJsonSync, unescapeScope, visitLicenses, };
|
package/dist/packages.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -75,10 +76,10 @@ var import_licenses = require("./packages/licenses");
|
|
|
75
76
|
var import_manifest = require("./packages/manifest");
|
|
76
77
|
var import_normalize = require("./packages/normalize");
|
|
77
78
|
var import_operations = require("./packages/operations");
|
|
78
|
-
var import_packages = require("./paths/packages");
|
|
79
79
|
var import_provenance = require("./packages/provenance");
|
|
80
80
|
var import_specs = require("./packages/specs");
|
|
81
81
|
var import_validation = require("./packages/validation");
|
|
82
|
+
var import_packages = require("./paths/packages");
|
|
82
83
|
// Annotate the CommonJS export names for ESM import in node:
|
|
83
84
|
0 && (module.exports = {
|
|
84
85
|
collectIncompatibleLicenses,
|
package/dist/paths/dirnames.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Directory name and path pattern constants.
|
|
3
3
|
*/
|
|
4
|
-
// Directory names.
|
|
5
4
|
export declare const NODE_MODULES = "node_modules";
|
|
6
5
|
export declare const DOT_GIT_DIR = ".git";
|
|
7
6
|
export declare const DOT_GITHUB = ".github";
|
|
8
7
|
export declare const DOT_SOCKET_DIR = ".socket";
|
|
9
8
|
export declare const CACHE_DIR = "cache";
|
|
10
9
|
export declare const CACHE_TTL_DIR = "ttl";
|
|
11
|
-
// Path patterns.
|
|
12
10
|
export declare const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
|
|
13
11
|
export declare const SLASH_NODE_MODULES_SLASH = "/node_modules/";
|
package/dist/paths/dirnames.js
CHANGED
package/dist/paths/exts.d.ts
CHANGED
package/dist/paths/exts.js
CHANGED
package/dist/paths/filenames.js
CHANGED
package/dist/paths/globs.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Glob pattern constants.
|
|
3
3
|
*/
|
|
4
|
-
// Glob patterns.
|
|
5
4
|
export declare const LICENSE_GLOB = "LICEN[CS]E{[.-]*,}";
|
|
6
5
|
export declare const LICENSE_GLOB_RECURSIVE = "**/LICEN[CS]E{[.-]*,}";
|
|
7
6
|
export declare const LICENSE_ORIGINAL_GLOB = "*.original{.*,}";
|
package/dist/paths/globs.js
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @fileoverview Path manipulation utilities with cross-platform support.
|
|
3
|
+
* Provides path normalization, validation, and file extension handling.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Convert Unix-style POSIX paths to native Windows paths.
|
|
3
7
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
8
|
+
* This is the inverse of {@link toUnixPath}. On Windows, MSYS-style paths use
|
|
9
|
+
* `/c/` notation for drive letters and forward slashes, which PowerShell and
|
|
10
|
+
* cmd.exe cannot resolve. This function converts them to native Windows format
|
|
11
|
+
* with backslashes and proper drive letters.
|
|
7
12
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
13
|
+
* Conversion rules:
|
|
14
|
+
* - On Windows: Converts drive notation and separators to native format
|
|
15
|
+
* - `/c/path/to/file` becomes `C:\path\to\file`
|
|
16
|
+
* - `/d/projects/app` becomes `D:\projects\app`
|
|
17
|
+
* - Forward slashes become backslashes
|
|
18
|
+
* - Drive letters are always uppercase in the output
|
|
19
|
+
* - On Unix: Returns the normalized path unchanged (forward slashes preserved)
|
|
10
20
|
*
|
|
11
|
-
* @param {string | Buffer | URL} pathLike - The path to
|
|
12
|
-
* @returns {
|
|
21
|
+
* @param {string | Buffer | URL} pathLike - The MSYS/Unix-style path to convert
|
|
22
|
+
* @returns {string} Native Windows path (e.g., `C:\path\to\file`) or normalized Unix path
|
|
13
23
|
*
|
|
14
24
|
* @example
|
|
15
25
|
* ```typescript
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
26
|
+
* // MSYS drive letter paths (Windows)
|
|
27
|
+
* fromUnixPath('/c/projects/app/file.txt') // 'C:\\projects\\app\\file.txt'
|
|
28
|
+
* fromUnixPath('/d/projects/foo/bar') // 'D:\\projects\\foo\\bar'
|
|
29
|
+
* fromUnixPath('/c') // 'C:\\'
|
|
30
|
+
*
|
|
31
|
+
* // Forward-slash paths (Windows)
|
|
32
|
+
* fromUnixPath('C:/Windows/System32') // 'C:\\Windows\\System32'
|
|
33
|
+
*
|
|
34
|
+
* // Unix (unchanged, forward slashes preserved)
|
|
35
|
+
* fromUnixPath('/tmp/build/output') // '/tmp/build/output'
|
|
20
36
|
* ```
|
|
21
37
|
*/
|
|
22
|
-
|
|
23
|
-
export declare function isNodeModules(pathLike: string | Buffer | URL): boolean;
|
|
38
|
+
export declare function fromUnixPath(pathLike: string | Buffer | URL): string;
|
|
24
39
|
/**
|
|
25
40
|
* Check if a path is absolute.
|
|
26
41
|
*
|
|
@@ -66,8 +81,29 @@ export declare function isNodeModules(pathLike: string | Buffer | URL): boolean;
|
|
|
66
81
|
* isAbsolute('.') // false
|
|
67
82
|
* ```
|
|
68
83
|
*/
|
|
69
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
70
84
|
export declare function isAbsolute(pathLike: string | Buffer | URL): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Check if a path contains node_modules directory.
|
|
87
|
+
*
|
|
88
|
+
* Detects whether a given path includes a `node_modules` directory segment.
|
|
89
|
+
* This is useful for identifying npm package dependencies and filtering
|
|
90
|
+
* dependency-related paths.
|
|
91
|
+
*
|
|
92
|
+
* The check matches `node_modules` appearing as a complete path segment,
|
|
93
|
+
* ensuring it is either at the start, end, or surrounded by path separators.
|
|
94
|
+
*
|
|
95
|
+
* @param {string | Buffer | URL} pathLike - The path to check
|
|
96
|
+
* @returns {boolean} `true` if the path contains `node_modules`, `false` otherwise
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* isNodeModules('/project/node_modules/package') // true
|
|
101
|
+
* isNodeModules('node_modules/package/index.js') // true
|
|
102
|
+
* isNodeModules('/src/my_node_modules_backup') // false
|
|
103
|
+
* isNodeModules('/project/src/index.js') // false
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function isNodeModules(pathLike: string | Buffer | URL): boolean;
|
|
71
107
|
/**
|
|
72
108
|
* Check if a value is a valid file path (absolute or relative).
|
|
73
109
|
*
|
|
@@ -108,7 +144,6 @@ export declare function isAbsolute(pathLike: string | Buffer | URL): boolean;
|
|
|
108
144
|
* isPath('') // false - empty string
|
|
109
145
|
* ```
|
|
110
146
|
*/
|
|
111
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
112
147
|
export declare function isPath(pathLike: string | Buffer | URL): boolean;
|
|
113
148
|
/**
|
|
114
149
|
* Check if a path is relative.
|
|
@@ -139,7 +174,6 @@ export declare function isPath(pathLike: string | Buffer | URL): boolean;
|
|
|
139
174
|
* isRelative('\\\\server\\share') // false (Windows UNC)
|
|
140
175
|
* ```
|
|
141
176
|
*/
|
|
142
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
143
177
|
export declare function isRelative(pathLike: string | Buffer | URL): boolean;
|
|
144
178
|
/**
|
|
145
179
|
* Check if a path uses MSYS/Git Bash Unix-style drive letter notation.
|
|
@@ -173,43 +207,7 @@ export declare function isRelative(pathLike: string | Buffer | URL): boolean;
|
|
|
173
207
|
* isUnixPath('') // false
|
|
174
208
|
* ```
|
|
175
209
|
*/
|
|
176
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
177
210
|
export declare function isUnixPath(pathLike: string | Buffer | URL): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Convert Unix-style POSIX paths to native Windows paths.
|
|
180
|
-
*
|
|
181
|
-
* This is the inverse of {@link toUnixPath}. On Windows, MSYS-style paths use
|
|
182
|
-
* `/c/` notation for drive letters and forward slashes, which PowerShell and
|
|
183
|
-
* cmd.exe cannot resolve. This function converts them to native Windows format
|
|
184
|
-
* with backslashes and proper drive letters.
|
|
185
|
-
*
|
|
186
|
-
* Conversion rules:
|
|
187
|
-
* - On Windows: Converts drive notation and separators to native format
|
|
188
|
-
* - `/c/path/to/file` becomes `C:\path\to\file`
|
|
189
|
-
* - `/d/projects/app` becomes `D:\projects\app`
|
|
190
|
-
* - Forward slashes become backslashes
|
|
191
|
-
* - Drive letters are always uppercase in the output
|
|
192
|
-
* - On Unix: Returns the normalized path unchanged (forward slashes preserved)
|
|
193
|
-
*
|
|
194
|
-
* @param {string | Buffer | URL} pathLike - The MSYS/Unix-style path to convert
|
|
195
|
-
* @returns {string} Native Windows path (e.g., `C:\path\to\file`) or normalized Unix path
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* // MSYS drive letter paths (Windows)
|
|
200
|
-
* fromUnixPath('/c/projects/app/file.txt') // 'C:\\projects\\app\\file.txt'
|
|
201
|
-
* fromUnixPath('/d/projects/foo/bar') // 'D:\\projects\\foo\\bar'
|
|
202
|
-
* fromUnixPath('/c') // 'C:\\'
|
|
203
|
-
*
|
|
204
|
-
* // Forward-slash paths (Windows)
|
|
205
|
-
* fromUnixPath('C:/Windows/System32') // 'C:\\Windows\\System32'
|
|
206
|
-
*
|
|
207
|
-
* // Unix (unchanged, forward slashes preserved)
|
|
208
|
-
* fromUnixPath('/tmp/build/output') // '/tmp/build/output'
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
212
|
-
export declare function fromUnixPath(pathLike: string | Buffer | URL): string;
|
|
213
211
|
/**
|
|
214
212
|
* Normalize a path by converting backslashes to forward slashes and collapsing segments.
|
|
215
213
|
*
|
|
@@ -269,7 +267,6 @@ export declare function fromUnixPath(pathLike: string | Buffer | URL): string;
|
|
|
269
267
|
* normalizePath('/safe/../../unsafe') // '/unsafe' ⚠️
|
|
270
268
|
* ```
|
|
271
269
|
*/
|
|
272
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
273
270
|
export declare function normalizePath(pathLike: string | Buffer | URL): string;
|
|
274
271
|
/**
|
|
275
272
|
* Convert a path-like value to a string.
|
|
@@ -313,8 +310,42 @@ export declare function normalizePath(pathLike: string | Buffer | URL): string;
|
|
|
313
310
|
* pathLikeToString(new URL('file:///path%20with%20spaces')) // '/path with spaces'
|
|
314
311
|
* ```
|
|
315
312
|
*/
|
|
316
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
317
313
|
export declare function pathLikeToString(pathLike: string | Buffer | URL | null | undefined): string;
|
|
314
|
+
/**
|
|
315
|
+
* Get the relative path from one path to another.
|
|
316
|
+
*
|
|
317
|
+
* Computes the relative path from `from` to `to` and normalizes the result.
|
|
318
|
+
* This is a convenience wrapper around the `relative()` function that adds
|
|
319
|
+
* path normalization (converting separators and collapsing segments).
|
|
320
|
+
*
|
|
321
|
+
* The function:
|
|
322
|
+
* 1. Calculates the relative path using `relative()`
|
|
323
|
+
* 2. Normalizes the result using `normalizePath()`
|
|
324
|
+
* 3. Preserves empty strings (same path) without converting to `.`
|
|
325
|
+
*
|
|
326
|
+
* @param {string} from - The source path (starting point)
|
|
327
|
+
* @param {string} to - The destination path (target)
|
|
328
|
+
* @returns {string} The normalized relative path from `from` to `to`, or empty string if paths are identical
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* // Basic usage
|
|
333
|
+
* relativeResolve('/foo/bar', '/foo/baz') // '../baz'
|
|
334
|
+
* relativeResolve('/foo/bar/baz', '/foo') // '../..'
|
|
335
|
+
* relativeResolve('/foo', '/foo/bar') // 'bar'
|
|
336
|
+
*
|
|
337
|
+
* // Same paths
|
|
338
|
+
* relativeResolve('/foo/bar', '/foo/bar') // ''
|
|
339
|
+
*
|
|
340
|
+
* // Windows paths (normalized)
|
|
341
|
+
* relativeResolve('C:\\foo\\bar', 'C:\\foo\\baz') // '../baz'
|
|
342
|
+
*
|
|
343
|
+
* // With normalization
|
|
344
|
+
* relativeResolve('/foo/./bar', '/foo/baz') // '../baz'
|
|
345
|
+
* relativeResolve('/foo/bar/../baz', '/foo/qux') // '../qux'
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
export declare function relativeResolve(from: string, to: string): string;
|
|
318
349
|
/**
|
|
319
350
|
* Split a path into an array of segments.
|
|
320
351
|
*
|
|
@@ -353,74 +384,7 @@ export declare function pathLikeToString(pathLike: string | Buffer | URL | null
|
|
|
353
384
|
* splitPath('/foo//bar/') // ['', 'foo', '', 'bar', '']
|
|
354
385
|
* ```
|
|
355
386
|
*/
|
|
356
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
357
387
|
export declare function splitPath(pathLike: string | Buffer | URL): string[];
|
|
358
|
-
/**
|
|
359
|
-
* Remove leading ./ or ../ from a path.
|
|
360
|
-
*
|
|
361
|
-
* Strips the `./` or `.\` prefix from relative paths. This is useful for
|
|
362
|
-
* normalizing paths when the current directory reference is implicit or
|
|
363
|
-
* unwanted.
|
|
364
|
-
*
|
|
365
|
-
* Note: This function only removes a single leading `./` or `.\`. It does
|
|
366
|
-
* not remove `../` prefixes or process the rest of the path.
|
|
367
|
-
*
|
|
368
|
-
* @param {string | Buffer | URL} pathLike - The path to process
|
|
369
|
-
* @returns {string} The path without leading `./` or `.\`, or unchanged if no such prefix
|
|
370
|
-
*
|
|
371
|
-
* @example
|
|
372
|
-
* ```typescript
|
|
373
|
-
* // Remove ./ prefix
|
|
374
|
-
* trimLeadingDotSlash('./src/index.js') // 'src/index.js'
|
|
375
|
-
* trimLeadingDotSlash('.\\src\\file.txt') // 'src\\file.txt'
|
|
376
|
-
*
|
|
377
|
-
* // Preserve ../ prefix
|
|
378
|
-
* trimLeadingDotSlash('../lib/util.js') // '../lib/util.js'
|
|
379
|
-
*
|
|
380
|
-
* // No change for other paths
|
|
381
|
-
* trimLeadingDotSlash('/absolute/path') // '/absolute/path'
|
|
382
|
-
* trimLeadingDotSlash('relative/path') // 'relative/path'
|
|
383
|
-
* trimLeadingDotSlash('.') // '.'
|
|
384
|
-
* ```
|
|
385
|
-
*/
|
|
386
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
387
|
-
export declare function trimLeadingDotSlash(pathLike: string | Buffer | URL): string;
|
|
388
|
-
/**
|
|
389
|
-
* Get the relative path from one path to another.
|
|
390
|
-
*
|
|
391
|
-
* Computes the relative path from `from` to `to` and normalizes the result.
|
|
392
|
-
* This is a convenience wrapper around the `relative()` function that adds
|
|
393
|
-
* path normalization (converting separators and collapsing segments).
|
|
394
|
-
*
|
|
395
|
-
* The function:
|
|
396
|
-
* 1. Calculates the relative path using `relative()`
|
|
397
|
-
* 2. Normalizes the result using `normalizePath()`
|
|
398
|
-
* 3. Preserves empty strings (same path) without converting to `.`
|
|
399
|
-
*
|
|
400
|
-
* @param {string} from - The source path (starting point)
|
|
401
|
-
* @param {string} to - The destination path (target)
|
|
402
|
-
* @returns {string} The normalized relative path from `from` to `to`, or empty string if paths are identical
|
|
403
|
-
*
|
|
404
|
-
* @example
|
|
405
|
-
* ```typescript
|
|
406
|
-
* // Basic usage
|
|
407
|
-
* relativeResolve('/foo/bar', '/foo/baz') // '../baz'
|
|
408
|
-
* relativeResolve('/foo/bar/baz', '/foo') // '../..'
|
|
409
|
-
* relativeResolve('/foo', '/foo/bar') // 'bar'
|
|
410
|
-
*
|
|
411
|
-
* // Same paths
|
|
412
|
-
* relativeResolve('/foo/bar', '/foo/bar') // ''
|
|
413
|
-
*
|
|
414
|
-
* // Windows paths (normalized)
|
|
415
|
-
* relativeResolve('C:\\foo\\bar', 'C:\\foo\\baz') // '../baz'
|
|
416
|
-
*
|
|
417
|
-
* // With normalization
|
|
418
|
-
* relativeResolve('/foo/./bar', '/foo/baz') // '../baz'
|
|
419
|
-
* relativeResolve('/foo/bar/../baz', '/foo/qux') // '../qux'
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
423
|
-
export declare function relativeResolve(from: string, to: string): string;
|
|
424
388
|
/**
|
|
425
389
|
* Convert Windows paths to MSYS/Unix-style POSIX paths for Git Bash tools.
|
|
426
390
|
*
|
|
@@ -462,5 +426,33 @@ export declare function relativeResolve(from: string, to: string): string;
|
|
|
462
426
|
* toUnixPath('\\\\server\\share\\file') // '//server/share/file'
|
|
463
427
|
* ```
|
|
464
428
|
*/
|
|
465
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
466
429
|
export declare function toUnixPath(pathLike: string | Buffer | URL): string;
|
|
430
|
+
/**
|
|
431
|
+
* Remove leading ./ or ../ from a path.
|
|
432
|
+
*
|
|
433
|
+
* Strips the `./` or `.\` prefix from relative paths. This is useful for
|
|
434
|
+
* normalizing paths when the current directory reference is implicit or
|
|
435
|
+
* unwanted.
|
|
436
|
+
*
|
|
437
|
+
* Note: This function only removes a single leading `./` or `.\`. It does
|
|
438
|
+
* not remove `../` prefixes or process the rest of the path.
|
|
439
|
+
*
|
|
440
|
+
* @param {string | Buffer | URL} pathLike - The path to process
|
|
441
|
+
* @returns {string} The path without leading `./` or `.\`, or unchanged if no such prefix
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* // Remove ./ prefix
|
|
446
|
+
* trimLeadingDotSlash('./src/index.js') // 'src/index.js'
|
|
447
|
+
* trimLeadingDotSlash('.\\src\\file.txt') // 'src\\file.txt'
|
|
448
|
+
*
|
|
449
|
+
* // Preserve ../ prefix
|
|
450
|
+
* trimLeadingDotSlash('../lib/util.js') // '../lib/util.js'
|
|
451
|
+
*
|
|
452
|
+
* // No change for other paths
|
|
453
|
+
* trimLeadingDotSlash('/absolute/path') // '/absolute/path'
|
|
454
|
+
* trimLeadingDotSlash('relative/path') // 'relative/path'
|
|
455
|
+
* trimLeadingDotSlash('.') // '.'
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
export declare function trimLeadingDotSlash(pathLike: string | Buffer | URL): string;
|