Skip to content

Commit

Permalink
rename from esm modules to esm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed May 11, 2023
1 parent bc1c230 commit 3094ba8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { DvcViewer } from './cli/dvc/viewer'
import { registerSetupCommands } from './setup/register'
import { Status } from './status'
import { registerPersistenceCommands } from './persistence/register'
import { esmModulesImported } from './util/esm'
import { esmPackagesImported } from './util/esm'

class Extension extends Disposable {
protected readonly internalCommands: InternalCommands
Expand Down Expand Up @@ -305,7 +305,7 @@ class Extension extends Disposable {
let extension: undefined | Extension

export async function activate(context: ExtensionContext): Promise<void> {
await esmModulesImported
await esmPackagesImported
extension = new Extension(context)
context.subscriptions.push(extension)
}
Expand Down
4 changes: 2 additions & 2 deletions extension/src/python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getProcessPlatform } from '../env'
import { exists } from '../fileSystem'
import { Logger } from '../common/logger'
import { createProcess, executeProcess, Process } from '../process/execution'
import { esmModulesImported } from '../util/esm'
import { esmPackagesImported } from '../util/esm'

const sendOutput = (process: Process) => {
process.all?.on('data', chunk =>
Expand Down Expand Up @@ -35,7 +35,7 @@ export const setupTestVenv = async (
envDir: string,
...installArgs: string[]
) => {
await esmModulesImported
await esmPackagesImported
if (!exists(join(cwd, envDir))) {
const initVenv = createProcess({
args: ['-m', 'venv', envDir],
Expand Down
10 changes: 5 additions & 5 deletions extension/src/test/suite/cli/child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { delay } from '../../../util/time'

require('../../../vscode/mockModule')

const importModuleAfterMockingVsCode = () => {
const importModuleAfterMockingVsCode = async () => {
const { Cli } = require('../../../cli')
const { esmModulesImported } = require('../../../util/esm')
return { Cli, esmModulesImported }
const { esmPackagesImported } = require('../../../util/esm')
await esmPackagesImported
return { Cli }
}

const main = async () => {
const { Cli, esmModulesImported } = importModuleAfterMockingVsCode()
const { Cli } = await importModuleAfterMockingVsCode()

await esmModulesImported
const cli = new Cli()

const options = getOptions('background')
Expand Down
6 changes: 3 additions & 3 deletions extension/src/util/esm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Deferred } from '@hediet/std/synchronization'

const deferred = new Deferred()
export const esmModulesImported = deferred.promise
export const esmPackagesImported = deferred.promise

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand All @@ -14,7 +14,7 @@ const shouldImportEsm = !process.env.JEST_WORKER_ID

let execa: EsmExeca
let doesProcessExist: EsmProcessExists
const importEsmModules = async () => {
const importEsmPackages = async () => {
const [{ execa: esmExeca }, { processExists: esmProcessExists }] =
await Promise.all([import('execa'), import('process-exists')])
execa = esmExeca
Expand All @@ -23,7 +23,7 @@ const importEsmModules = async () => {
}

if (shouldImportEsm) {
void importEsmModules()
void importEsmPackages()
}

export { execa, doesProcessExist }

0 comments on commit 3094ba8

Please sign in to comment.