-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix import errors from core package once again
After restructuring the core package, dynamic imports did not work any longer because apparently, they must not be called from submodules. Relates #65 and microsoft/TypeScript#43329, again.
- Loading branch information
Showing
7 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import dotenv from 'dotenv' | ||
import { Hook } from '@oclif/config' | ||
import { loadExternalModules } from 'dowdep' | ||
|
||
export const hook: Hook<'init'> = async function (options) { | ||
dotenv.config() | ||
await loadExternalModules() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Import, Options } from "parse-imports" | ||
|
||
|
||
/** | ||
* Stores external modules that have been loaded in a non-standard, weird way. | ||
* | ||
* The existence of this is a large workaround. Some components of our toolchain, including oclif and jest, do not support dynamic importing of pure ES modules correctly. See `loadExternalModules()` in `index.ts`. As the technique used there cannot be applied from submodules, imported modules are stored in this file. | ||
*/ | ||
const modules = { | ||
/** Escape RegExp special characters */ | ||
escapeRegexp: <(regex: string) => string><any>undefined, | ||
/** A blazing fast ES module imports parser. */ | ||
parseImports: <( | ||
code: string, | ||
options?: Options | ||
) => Promise<Iterable<Import>>><any>undefined | ||
} | ||
|
||
export default modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters