Skip to content

Commit a647b60

Browse files
committed
Remove unused ModuleWithDirection from Node runtime
1 parent a9583de commit a647b60

File tree

1 file changed

+5
-18
lines changed
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs

1 file changed

+5
-18
lines changed

turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const url = require('url') as typeof import('url')
6262
const fs = require('fs/promises') as typeof import('fs/promises')
6363

6464
const moduleFactories: ModuleFactories = Object.create(null)
65-
const moduleCache: ModuleCache<ModuleWithDirection> = Object.create(null)
65+
const moduleCache: ModuleCache<Module> = Object.create(null)
6666

6767
/**
6868
* Returns an absolute path to the given module's id.
@@ -213,10 +213,7 @@ function getWorkerBlobURL(_chunks: ChunkPath[]): string {
213213
throw new Error('Worker blobs are not implemented yet for Node.js')
214214
}
215215

216-
function instantiateModule(
217-
id: ModuleId,
218-
source: SourceInfo
219-
): ModuleWithDirection {
216+
function instantiateModule(id: ModuleId, source: SourceInfo): Module {
220217
const moduleFactory = moduleFactories[id]
221218
if (typeof moduleFactory !== 'function') {
222219
// This can happen if modules incorrectly handle HMR disposes/updates,
@@ -252,13 +249,11 @@ function instantiateModule(
252249
invariant(source, (source) => `Unknown source type: ${source?.type}`)
253250
}
254251

255-
const module: ModuleWithDirection = {
252+
const module: Module = {
256253
exports: {},
257254
error: undefined,
258255
loaded: false,
259256
id,
260-
parents,
261-
children: [],
262257
namespaceObject: undefined,
263258
}
264259
moduleCache[id] = module
@@ -315,19 +310,11 @@ function instantiateModule(
315310
// @ts-ignore
316311
function getOrInstantiateModuleFromParent(
317312
id: ModuleId,
318-
sourceModule: ModuleWithDirection
319-
): ModuleWithDirection {
313+
sourceModule: Module
314+
): Module {
320315
const module = moduleCache[id]
321316

322-
if (sourceModule.children.indexOf(id) === -1) {
323-
sourceModule.children.push(id)
324-
}
325-
326317
if (module) {
327-
if (module.parents.indexOf(sourceModule.id) === -1) {
328-
module.parents.push(sourceModule.id)
329-
}
330-
331318
return module
332319
}
333320

0 commit comments

Comments
 (0)