@travetto/manifest
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -1,3 +0,2 @@ | ||
/// <reference path="../runtime/src/global.d.ts" /> | ||
export * from './src/context'; | ||
export * from './src/module'; | ||
@@ -4,0 +3,0 @@ export * from './src/delta'; |
{ | ||
"name": "@travetto/manifest", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "Support for project indexing, manifesting, along with file watching", | ||
@@ -18,3 +18,2 @@ "keywords": [ | ||
}, | ||
"type": "module", | ||
"files": [ | ||
@@ -21,0 +20,0 @@ "__index__.ts", |
@@ -137,2 +137,3 @@ <!-- This file was generated by @travetto/doc and should not be modified directly --> | ||
"src": [ | ||
[ "src/context.ts", "ts", 1868155200000 ], | ||
[ "src/delta.ts", "ts", 1868155200000 ], | ||
@@ -150,6 +151,2 @@ [ "src/dependencies.ts", "ts", 1868155200000 ], | ||
[ "src/types/package.ts", "ts", 1868155200000 ] | ||
], | ||
"bin": [ | ||
[ "bin/context.d.ts", "typings", 1868155200000 ], | ||
[ "bin/context.js", "js", 1868155200000 ] | ||
] | ||
@@ -156,0 +153,0 @@ } |
@@ -15,4 +15,4 @@ import fs from 'node:fs/promises'; | ||
const VALID_SOURCE_FOLDERS = new Set<ManifestModuleFolderType>(['bin', 'src', 'test', 'support', '$index', '$package', 'doc']); | ||
const VALID_OUTPUT_TYPE = new Set<ManifestModuleFileType>(['js', 'ts', 'package-json']); | ||
const VALID_SOURCE_TYPE = new Set<ManifestModuleFileType>([...VALID_OUTPUT_TYPE, 'typings']); | ||
const VALID_SOURCE_TYPE = new Set<ManifestModuleFileType>(['js', 'ts', 'package-json']); | ||
const VALID_OUTPUT_TYPE = new Set<ManifestModuleFileType>([...VALID_SOURCE_TYPE, 'typings']); | ||
@@ -19,0 +19,0 @@ const TypedObject: { keys<T = unknown, K extends keyof T = keyof T>(o: T): K[] } & ObjectConstructor = Object; |
@@ -27,3 +27,5 @@ import fs from 'node:fs/promises'; | ||
const STD_TOP_FOLDERS = new Set(['src', 'bin', 'support']); | ||
const FULL_TOP_FOLDERS = new Set([...STD_TOP_FOLDERS, 'doc', 'test', 'resources']); | ||
const STD_TOP_FILES = new Set([...INDEX_FILES, 'package.json']); | ||
const FULL_TOP_FILES = new Set([...STD_TOP_FILES, 'DOC.tsx', 'README.md', 'LICENSE', 'DOC.html']); | ||
@@ -36,3 +38,3 @@ const SUPPORT_FILE_MAP: Record<string, ManifestModuleRole> = { | ||
pack: 'build', | ||
FILEld: 'build' | ||
build: 'build' | ||
}; | ||
@@ -53,4 +55,4 @@ | ||
*/ | ||
static #pathToExtension(inputFile: string, ext: string): string { | ||
return inputFile.replace(/[.][tj]sx?$/, ext); | ||
static #pathToExtension(sourceFile: string, ext: string): string { | ||
return sourceFile.replace(/[.][cm]?[tj]sx?$/, ext); | ||
} | ||
@@ -79,2 +81,5 @@ | ||
const topFolders = full ? FULL_TOP_FOLDERS : STD_TOP_FOLDERS; | ||
const topFiles = full ? FULL_TOP_FILES : STD_TOP_FILES; | ||
const stack: [string, number][] = [[folder, 0]]; | ||
@@ -92,4 +97,3 @@ while (stack.length) { | ||
continue; | ||
} | ||
if (exclude.has(top)) { | ||
} else if (exclude.has(top)) { | ||
continue; | ||
@@ -99,11 +103,14 @@ } | ||
for (const sub of await fs.readdir(top)) { | ||
const valid = !sub.startsWith('.') && (depth > 0 || full); | ||
const stat = await fs.stat(`${top}/${sub}`); | ||
if (sub.startsWith('.') || sub === 'node_modules') { | ||
continue; | ||
} | ||
const fullPath = `${top}/${sub}`; | ||
const stat = await fs.stat(fullPath); | ||
if (stat.isFile()) { | ||
if (valid || STD_TOP_FILES.has(sub)) { | ||
out.push(`${top}/${sub}`); | ||
if (depth > 0 || topFiles.has(sub)) { | ||
out.push(fullPath); | ||
} | ||
} else { | ||
if (!sub.includes('node_modules') && (valid || STD_TOP_FOLDERS.has(sub))) { | ||
stack.push([`${top}/${sub}`, depth + 1]); | ||
if (depth > 0 || topFolders.has(sub)) { | ||
stack.push([fullPath, depth + 1]); | ||
} | ||
@@ -176,3 +183,3 @@ } | ||
case 'support': return key; | ||
default: return '$other'; | ||
default: throw new Error(`Unknown folder: ${key}`); | ||
} | ||
@@ -237,4 +244,7 @@ } else if (/^DOC[.]tsx?$/.test(moduleFile)) { | ||
*/ | ||
static withOutputExtension(inputFile: string): string { | ||
return this.#pathToExtension(inputFile, '.js'); | ||
static withOutputExtension(sourceFile: string): string { | ||
if (sourceFile.endsWith('.d.ts')) { | ||
return sourceFile; | ||
} | ||
return this.#pathToExtension(sourceFile, '.js'); | ||
} | ||
@@ -245,5 +255,8 @@ | ||
*/ | ||
static withoutSourceExtension(inputFile: string): string { | ||
return this.#pathToExtension(inputFile, ''); | ||
static withoutSourceExtension(sourceFile: string): string { | ||
if (sourceFile.endsWith('.d.ts')) { | ||
return sourceFile; | ||
} | ||
return this.#pathToExtension(sourceFile, ''); | ||
} | ||
} |
@@ -24,2 +24,3 @@ import posix from 'node:path/posix'; | ||
toPosix, | ||
matchesGlob: (file, pattern) => posix.matchesGlob(toPosix(file), toPosix(pattern)), | ||
...process.platform === 'win32' ? { | ||
@@ -26,0 +27,0 @@ resolve: (...args) => toPosix(native.resolve(cwd(), ...args.map(toPosix))), |
@@ -9,4 +9,4 @@ export type NodeModuleType = 'module' | 'commonjs'; | ||
'test/fixtures' | 'support/fixtures' | 'support/resources' | | ||
'$other' | '$transformer'; | ||
'$transformer'; | ||
export type ManifestModuleRole = 'std' | 'test' | 'doc' | 'compile' | 'build'; |
@@ -40,2 +40,2 @@ import type { NodeModuleType, NodePackageManager } from './common'; | ||
}; | ||
}; | ||
}; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
61727
1
17
1379
212
No