Unverified Commit 940cee25 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub
parent 0d10c073
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */ /* auto-generated by NAPI-RS */
/* eslint-disable */
export interface NapiNftResult { export interface NapiNftResult {
files: Array<RcStr> files: Array<RcStr>
issues: Array<RcStr> issues: Array<RcStr>
} }
export declare function nodeFileTrace(projectRoot: RcStr, cwd: RcStr, outputBase: RcStr, input: Array<string>, graph: boolean, showIssues: boolean, maxDepth?: number | undefined | null): Promise<NapiNftResult>
export declare function nodeFileTrace(
projectRoot: RcStr,
cwd: RcStr,
outputBase: RcStr,
input: Array<string>,
graph: boolean,
showIssues: boolean,
maxDepth?: number | undefined | null
): Promise<NapiNftResult>
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build-native": "napi build --platform -p turbopack-nft-napi --cargo-cwd ../../../ --cargo-name turbopack_nft_napi --js false native", "build-native": "napi build --platform -p turbopack-nft-napi --manifest-path ../../Cargo.toml --no-js -o native",
"build-native-release": "napi build --platform -p turbopack-nft-napi --cargo-cwd ../../../ --cargo-name turbopack_nft_napi --release --js false native" "build-native-release": "napi build --platform -p turbopack-nft-napi --manifest-path ../../Cargo.toml --release --no-js -o native"
}, },
"napi": { "napi": {
"name": "turbopack-nft", "binaryName": "turbopack-nft",
"triples": { "targets": [
"defaults": true, "x86_64-apple-darwin",
"additional": [ "x86_64-pc-windows-msvc",
"aarch64-apple-darwin", "x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu", "aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-musl", "aarch64-apple-darwin",
"aarch64-unknown-linux-musl" "x86_64-unknown-linux-musl",
] "aarch64-unknown-linux-musl"
} ]
}, },
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "2.18.4" "@napi-rs/cli": "3.7.2"
} }
} }
import path from 'path'
const native =
require('../native/turbopack-nft.darwin-arm64.node') as typeof import('../native/index.d.ts')
export interface NodeFileTraceOptions {
base?: string
processCwd?: string
exports?: string[]
conditions?: string[]
exportsOnly?: boolean
ignore?: string | string[] | ((path: string) => boolean)
analysis?:
| boolean
| {
emitGlobs?: boolean
computeFileReferences?: boolean
evaluatePureExpressions?: boolean
}
cache?: any
paths?: Record<string, string>
ts?: boolean
log?: boolean
mixedModules?: boolean
// readFile?: (path: string) => Promise<Buffer | string | null>
// stat?: (path: string) => Promise<Stats | null>
// readlink?: (path: string) => Promise<string | null>
// resolve?: (
// id: string,
// parent: string,
// job: Job,
// cjsResolve: boolean
// ) => Promise<string | string[]>
fileIOConcurrency?: number
depth?: number
}
export type NodeFileTraceReasonType =
| 'initial'
| 'resolve'
| 'dependency'
| 'asset'
| 'sharedlib'
export interface NodeFileTraceReasons
extends Map<
string,
{
type: NodeFileTraceReasonType[]
ignored: boolean
parents: Set<string>
}
> {}
export interface NodeFileTraceResult {
fileList: Set<string>
esmFileList: Set<string>
reasons: NodeFileTraceReasons
warnings: Set<Error>
}
export async function nodeFileTrace(
files: string[],
opts: NodeFileTraceOptions = {}
): Promise<NodeFileTraceResult> {
let base = path.resolve(opts.base || process.cwd())
let processCwd = path.resolve(opts.processCwd || base)
let root = base.length < processCwd.length ? base : processCwd
let x = await native.nodeFileTrace(
root,
path.relative(root, processCwd),
path.relative(root, base),
files.map((f) => path.relative(root, path.resolve(f))),
false,
false,
0
// TODO pass along ignore globs
)
let ignoreFn: Function | undefined =
typeof opts.ignore === 'function'
? // @ts-ignore
opts.ignore
: undefined
return {
fileList: new Set(ignoreFn ? x.files.filter((f) => !ignoreFn(f)) : x.files),
esmFileList: new Set(),
warnings: new Set(),
reasons: new Map(),
}
}
...@@ -1983,6 +1983,12 @@ importers: ...@@ -1983,6 +1983,12 @@ importers:
specifier: 6.0.2 specifier: 6.0.2
version: 6.0.2 version: 6.0.2
packages/tracing-napi:
devDependencies:
'@napi-rs/cli':
specifier: 3.7.2
version: 3.7.2(@emnapi/runtime@1.9.2)(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab))(node-addon-api@6.1.0)
turbopack/crates/turbopack-cli/js: turbopack/crates/turbopack-cli/js:
dependencies: dependencies:
'@vercel/turbopack-ecmascript-runtime': '@vercel/turbopack-ecmascript-runtime':
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment