Convert dlv require statements to imports (#521)

It was already imported in one place, that appears to work fine.

Using `require` results in invalid ESM output, because `require` is not
defined in ES modules.
master
Remco Haszing 2022-04-13 18:10:47 +02:00 committed by GitHub
parent 7dd5646e6f
commit bc2e5edd45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 12 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import { getClassNameMeta } from '../util/getClassNameMeta'
import { getClassNameParts } from '../util/getClassNameAtPosition'
import { validateApply } from '../util/validateApply'
import { isWithinRange } from '../util/isWithinRange'
const dlv = require('dlv')
import dlv from 'dlv'
import type { Root, Source } from 'postcss'
import { absoluteRange } from '../util/absoluteRange'
import { removeRangesFromString } from '../util/removeRangesFromString'

View File

@ -9,7 +9,7 @@ import type {
Position,
CompletionContext,
} from 'vscode-languageserver'
const dlv = require('dlv')
import dlv from 'dlv'
import removeMeta from './util/removeMeta'
import { getColor, getColorFromValue } from './util/color'
import { isHtmlContext } from './util/html'

View File

@ -9,7 +9,7 @@ import isObject from '../util/isObject'
import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange'
import { combinations } from '../util/combinations'
const dlv = require('dlv')
import dlv from 'dlv'
function pathToString(path: string | string[]): string {
if (typeof path === 'string') return path

View File

@ -6,7 +6,7 @@ import { getLanguageBoundaries } from '../util/getLanguageBoundaries'
import { findAll, indexToPosition } from '../util/find'
import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange'
const dlv = require('dlv')
import dlv from 'dlv'
export function getInvalidScreenDiagnostics(
state: State,

View File

@ -1,7 +1,7 @@
import { State } from './util/state'
import type { Hover, TextDocument, Position } from 'vscode-languageserver'
import { stringifyCss, stringifyConfigValue } from './util/stringify'
const dlv = require('dlv')
import dlv from 'dlv'
import { isCssContext } from './util/css'
import { findClassNameAtPosition } from './util/find'
import { validateApply } from './util/validateApply'

View File

@ -1,4 +1,4 @@
const dlv = require('dlv')
import dlv from 'dlv'
import { State } from './state'
import removeMeta from './removeMeta'
import { ensureArray, dedupe, flatten } from './array'

View File

@ -9,7 +9,7 @@ import { flatten } from './array'
import { getClassAttributeLexer, getComputedClassAttributeLexer } from './lexers'
import { getLanguageBoundaries } from './getLanguageBoundaries'
import { resolveRange } from './resolveRange'
const dlv = require('dlv')
import dlv from 'dlv'
import { createMultiRegexp } from './createMultiRegexp'
export function findAll(re: RegExp, str: string): RegExpMatchArray[] {

View File

@ -1,5 +1,5 @@
import { State } from './state'
const dlv = require('dlv')
import dlv from 'dlv'
export function flagEnabled(state: State, flag: string) {
if (state.featureFlags.future.includes(flag)) {

View File

@ -1,6 +1,6 @@
import { State } from './state'
import { combinations } from './combinations'
const dlv = require('dlv')
import dlv from 'dlv'
export function getClassNameParts(state: State, className: string): string[] {
let separator = state.separator

View File

@ -1,7 +1,7 @@
import { State } from './state'
import { getClassNameParts } from './getClassNameAtPosition'
import removeMeta from './removeMeta'
const dlv = require('dlv')
import dlv from 'dlv'
export function getClassNameDecls(
state: State,

View File

@ -1,6 +1,6 @@
import { State, ClassNameMeta } from './state'
import { getClassNameParts } from './getClassNameAtPosition'
const dlv = require('dlv')
import dlv from 'dlv'
export function getClassNameMeta(
state: State,

View File

@ -1,5 +1,5 @@
import removeMeta from './removeMeta'
const dlv = require('dlv')
import dlv from 'dlv'
import escapeClassName from 'css.escape'
import { ensureArray } from './array'
import { remToPx } from './remToPx'