@travetto/manifest
Advanced tools
Comparing version 5.0.0-rc.0 to 5.0.0-rc.1
{ | ||
"name": "@travetto/manifest", | ||
"version": "5.0.0-rc.0", | ||
"version": "5.0.0-rc.1", | ||
"description": "Support for project indexing, manifesting, along with file watching", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -38,3 +38,3 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
`Ⲑid` is used heavily throughout the framework for determining which classes are owned by the framework, and being able to lookup the needed data from the [RuntimeIndex](https://github.com/travetto/travetto/tree/main/module/manifest/src/runtime.ts#L14) using the `getFunctionMetadata` method. | ||
`Ⲑid` is used heavily throughout the framework for determining which classes are owned by the framework, and being able to lookup the needed data from the [RuntimeIndex](https://github.com/travetto/travetto/tree/main/module/manifest/src/runtime.ts#L12) using the `getFunctionMetadata` method. | ||
@@ -41,0 +41,0 @@ **Code: Test Class** |
import { path } from './path'; | ||
import { ManifestIndex } from './manifest-index'; | ||
import type { FunctionMetadata, FunctionMetadataTag } from './types/common'; | ||
import type { IndexedModule, ManifestModule } from './types/manifest'; | ||
import type { ManifestContext } from './types/context'; | ||
@@ -43,5 +41,5 @@ const METADATA = Symbol.for('@travetto/manifest:metadata'); | ||
/** | ||
* Get source file from import location | ||
* @param outputFile | ||
*/ | ||
* Get source file from import location | ||
* @param outputFile | ||
*/ | ||
getSourceFile(importFile: string): string { | ||
@@ -60,2 +58,3 @@ return this.getFromImport(importFile)?.sourceFile ?? importFile; | ||
* @param `synthetic` Is this code generated at build time | ||
* @private | ||
*/ | ||
@@ -86,3 +85,3 @@ registerFunction( | ||
*/ | ||
getFunctionMetadata(clsId: string | Function): FunctionMetadata | undefined { | ||
getFunctionMetadata(clsId?: string | Function): FunctionMetadata | undefined { | ||
const id = clsId === undefined ? '' : typeof clsId === 'string' ? clsId : clsId.Ⲑid; | ||
@@ -119,41 +118,2 @@ return this.#metadata.get(id); | ||
export const RuntimeIndex = new $RuntimeIndex(process.env.TRV_MANIFEST!); | ||
const build = <T extends object, K extends keyof ManifestContext>(inp: T, props: K[]): T & Pick<ManifestContext, K> => { | ||
for (const prop of props) { | ||
Object.defineProperty(inp, prop, { configurable: false, get: () => RuntimeIndex.manifest[prop] }); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
return inp as T & ManifestContext; | ||
}; | ||
export const RuntimeContext = build({ | ||
/** | ||
* Produce a workspace relative path | ||
* @param rel The relative path | ||
*/ | ||
workspaceRelative(...rel: string[]): string { | ||
return path.resolve(RuntimeIndex.manifest.workspace.path, ...rel); | ||
}, | ||
/** | ||
* Strip off the workspace path from a file | ||
* @param full A full path | ||
*/ | ||
stripWorkspacePath(full: string): string { | ||
return full === RuntimeIndex.manifest.workspace.path ? '' : full.replace(`${RuntimeIndex.manifest.workspace.path}/`, ''); | ||
}, | ||
/** | ||
* Produce a workspace path for tooling, with '@' being replaced by node_module/name folder | ||
* @param rel The relative path | ||
*/ | ||
toolPath(...rel: string[]): string { | ||
rel = rel.flatMap(x => x === '@' ? ['node_modules', RuntimeIndex.manifest.main.name] : [x]); | ||
return path.resolve(RuntimeIndex.manifest.workspace.path, RuntimeIndex.manifest.build.toolFolder, ...rel); | ||
}, | ||
/** | ||
* Are we running from a mono-root? | ||
*/ | ||
get monoRoot(): boolean { | ||
return !!RuntimeIndex.manifest.workspace.mono && !RuntimeIndex.manifest.main.folder; | ||
} | ||
}, ['main', 'workspace']); | ||
export const RuntimeIndex = new $RuntimeIndex(process.env.TRV_MANIFEST!); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72120
1628