@contrast/esm-hooks 2.38.1 → 2.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/hooks.mjs +3 -1
  2. package/package.json +5 -5
package/lib/hooks.mjs CHANGED
@@ -19,6 +19,7 @@ import { mappings } from './common.mjs';
19
19
  import { getFileType } from './get-file-type.mjs';
20
20
  import { default as initLoaderAgent } from './loader-agent.mjs';
21
21
  import { primordials } from '@contrast/common';
22
+ import { dirname } from 'node:path';
22
23
  const { StringPrototypeSplit, BufferPrototypeToString } = primordials;
23
24
 
24
25
  const [major, minor] = StringPrototypeSplit.call(process.versions.node, '.').map(it => +it);
@@ -105,7 +106,8 @@ async function load(url, context, nextLoad) {
105
106
  loaderAgent?.esmHooks?.debugEsmLoad?.(url);
106
107
 
107
108
  const urlObject = new URL(url);
108
- const type = await getFileType(url, loaderAgent?.appInfo.app_dir);
109
+ const stopAt = loaderAgent?.appInfo?.app_dir ? dirname(loaderAgent.appInfo.app_dir) : null;
110
+ const type = await getFileType(url, stopAt);
109
111
 
110
112
  // if it's not a builtin or a flagged file, it needs to be rewritten.
111
113
  // if it's not an es module it will be rewritten by the require hooks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/esm-hooks",
3
- "version": "2.38.1",
3
+ "version": "2.38.3",
4
4
  "type": "module",
5
5
  "description": "Support for loading and instrumenting ECMAScript modules",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@contrast/common": "1.41.1",
26
- "@contrast/config": "1.58.1",
27
- "@contrast/core": "1.63.1",
26
+ "@contrast/config": "1.58.2",
27
+ "@contrast/core": "1.63.2",
28
28
  "@contrast/find-package-json": "1.1.0",
29
- "@contrast/logger": "1.36.1",
30
- "@contrast/rewriter": "1.40.1"
29
+ "@contrast/logger": "1.36.2",
30
+ "@contrast/rewriter": "1.40.2"
31
31
  }
32
32
  }