Skip to content

Commit

Permalink
switch files to explicitly esm modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Trapfether committed Oct 10, 2023
1 parent e1e7409 commit 3e6fd9c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/config.js → src/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import resolveFrom from 'resolve-from'
import { generateRules as generateRulesFallback } from 'tailwindcss/lib/lib/generateRules'
// @ts-ignore
import { createContext as createContextFallback } from 'tailwindcss/lib/lib/setupContextUtils'
// @ts-ignore
import loadConfigFallback from 'tailwindcss/loadConfig'
// @ts-ignore
import resolveConfigFallback from 'tailwindcss/resolveConfig'
import { expiringMap } from './expiring-map.js'
import { expiringMap } from './expiring-map.mjs'

/**
* @typedef {{context: any, tailwindConfig: any, generateRules: any}} ContextContainer
Expand All @@ -18,7 +20,7 @@ import { expiringMap } from './expiring-map.js'
/**
* @template K
* @template V
* @typedef {import('./expiring-map.js').ExpiringMap<K,V>} ExpiringMap
* @typedef {import('./expiring-map.mjs').ExpiringMap<K,V>} ExpiringMap
**/

/** @type {Map<string, string | null>} */
Expand Down Expand Up @@ -135,7 +137,7 @@ function getConfigPath(options, baseDir) {

let configPath
try {
configPath = escalade(baseDir, (_dir, names) => {
configPath = escalade.default(baseDir, (_dir, names) => {
if (names.includes('tailwind.config.js')) {
return 'tailwind.config.js'
}
Expand Down
File renamed without changes.
8 changes: 3 additions & 5 deletions src/index.js → src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
'use strict';

import { commands, workspace, Range, window } from 'vscode';
import { getTextMatch, buildMatchers } from './utils';
import { getTextMatch, buildMatchers } from './utils.mjs';
import { spawn } from 'child_process';
import { rustyWindPath } from 'rustywind';
import { getTailwindConfig } from './config.js';
import { sortClasses } from './sorting.js'
import { getTailwindConfig } from './config.mjs';
import { sortClasses } from './sorting.mjs'

/**
* @typedef {import('vscode').ExtensionContext} ExtensionContext
Expand Down Expand Up @@ -40,8 +40,6 @@ export function activate(context) {
filepath: editorFilePath
});

const sorter = tailwindConfig.context.getClassOrder;

for (const matcher of matchers) {
getTextMatch(matcher.regex, editorText, (text, startPosition) => {
const endPosition = startPosition + text.length;
Expand Down
File renamed without changes.

0 comments on commit 3e6fd9c

Please sign in to comment.