update
This commit is contained in:
1 parent
9779c4d1ca
commit
1b578c111a
719 files changed
+191593
-98
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import type { PathMetadata } from "./package-manager.js";
|
||||
|
||||
export type SourceScope = "user" | "project" | "temporary";
|
||||
export type SourceOrigin = "package" | "top-level";
|
||||
|
||||
export interface SourceInfo {
|
||||
path: string;
|
||||
source: string;
|
||||
scope: SourceScope;
|
||||
origin: SourceOrigin;
|
||||
baseDir?: string;
|
||||
}
|
||||
|
||||
export function createSourceInfo(path: string, metadata: PathMetadata): SourceInfo {
|
||||
return {
|
||||
path,
|
||||
source: metadata.source,
|
||||
scope: metadata.scope,
|
||||
origin: metadata.origin,
|
||||
baseDir: metadata.baseDir,
|
||||
};
|
||||
}
|
||||
|
||||
export function createSyntheticSourceInfo(
|
||||
path: string,
|
||||
options: {
|
||||
source: string;
|
||||
scope?: SourceScope;
|
||||
origin?: SourceOrigin;
|
||||
baseDir?: string;
|
||||
},
|
||||
): SourceInfo {
|
||||
return {
|
||||
path,
|
||||
source: options.source,
|
||||
scope: options.scope ?? "temporary",
|
||||
origin: options.origin ?? "top-level",
|
||||
baseDir: options.baseDir,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user