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 { getClassNameParts } from '../util/getClassNameAtPosition'
import { validateApply } from '../util/validateApply' import { validateApply } from '../util/validateApply'
import { isWithinRange } from '../util/isWithinRange' import { isWithinRange } from '../util/isWithinRange'
const dlv = require('dlv') import dlv from 'dlv'
import type { Root, Source } from 'postcss' import type { Root, Source } from 'postcss'
import { absoluteRange } from '../util/absoluteRange' import { absoluteRange } from '../util/absoluteRange'
import { removeRangesFromString } from '../util/removeRangesFromString' import { removeRangesFromString } from '../util/removeRangesFromString'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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