Skip to content

Commit a2681b6

Browse files
committed
remove punycode, fix up index.js lookup
1 parent 31bb4ea commit a2681b6

6 files changed

Lines changed: 16 additions & 25 deletions

File tree

build-tests/api-extractor-test-05/dist/tsdoc-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"toolPackages": [
66
{
77
"packageName": "@microsoft/api-extractor",
8-
"packageVersion": "7.58.1"
8+
"packageVersion": "7.58.2"
99
}
1010
]
1111
}

common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "17c0403e10c0036d1cc57226f0d3c405f0e063b6",
3+
"pnpmShrinkwrapHash": "22153a6cd81b35a26ccaa94430114d26ad48026f",
44
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
5-
"packageJsonInjectedDependenciesHash": "aee23fb9482ddf1d02726d7cb55c36bc4cc5d4bf"
5+
"packageJsonInjectedDependenciesHash": "1fa5e72901cbee765da0520b9b3800b96efd87c8"
66
}

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

heft-plugins/heft-jest-plugin/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"jest-config": "~30.3.0",
3939
"jest-resolve": "~30.3.0",
4040
"jest-snapshot": "~30.3.0",
41-
"lodash": "~4.18.1",
42-
"punycode": "~2.3.1"
41+
"lodash": "~4.18.1"
4342
},
4443
"devDependencies": {
4544
"@jest/types": "30.3.0",

heft-plugins/heft-jest-plugin/src/patches/jestWorkerPatch.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,13 @@ function applyPatch(): void {
8989
}
9090
// Load the module
9191
const targetModule: IBaseWorkerPoolModule = require(targetPath);
92-
// Obtain the metadata for the module
93-
let targetModuleMetadata: NodeModule | undefined = undefined;
94-
for (const childModule of module.children) {
95-
// Match by full path to avoid false positives (e.g. many modules named index.js)
96-
if (childModule.filename === targetPath) {
97-
if (targetModuleMetadata) {
98-
throw new Error('More than one child module matched while detecting Node.js module metadata');
99-
}
100-
targetModuleMetadata = childModule;
101-
}
102-
}
92+
// Obtain the metadata for the module from require.cache.
93+
// We can't use module.children because if the module was already in the cache before this
94+
// require() call (loaded transitively by something else), Node.js returns the cached result
95+
// without appending it to module.children.
96+
// require.resolve() gives us the exact key Node.js uses in require.cache.
97+
const resolvedTargetPath: string = require.resolve(targetPath);
98+
const targetModuleMetadata: NodeModule | undefined = require.cache[resolvedTargetPath];
10399
if (!targetModuleMetadata) {
104100
throw new Error(`Failed to detect the Node.js module metadata for ${path.basename(targetPath)}`);
105101
}

0 commit comments

Comments
 (0)