Skip to content

Commit

Permalink
Entry Point should load the index.mjs file with dynamic imports
Browse files Browse the repository at this point in the history
Before the entry point was a cjs conversion of the ESM index.mjs. This caused module resolution issues when trying to load the tailwind config from the local workspace, specifically the extension would choke on tailwind plugin requires.
  • Loading branch information
Trapfether committed Oct 10, 2023
1 parent 8e35dee commit e40622e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let context = await esbuild.context({
target: 'node14.21.3',
external: ["vscode"],
minify: true,
entryPoints: [path.resolve(__dirname, './src/index.mjs')],
entryPoints: [path.resolve(__dirname, './src/loader.js')],
outfile: path.resolve(__dirname, './dist/index.js'),
format: 'cjs',
plugins: [patchRecast()],
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 37 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"color": "#f1f5f8"
},
"icon": "tailwind-raw-reorder-icon.gif",
"version": "3.0.2",
"version": "3.0.3",
"publisher": "Trapfether",
"license": "MIT",
"author": "Andrew Trefethen <[email protected]>",
Expand Down Expand Up @@ -56,47 +56,53 @@
"type": "object",
"default": {
"jade": [
{
"regex": "\\.([\\._a-zA-Z0-9\\-]+)",
"separator": "\\.",
"replacement": "."
},
"\\bclass\\s*=\\s*[\\\"\\']([\\._a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']"
{
"regex": "\\.([\\._a-zA-Z0-9\\-]+)",
"separator": "\\.",
"replacement": "."
},
"\\bclass\\s*=\\s*[\\\"\\']([\\._a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']"
],
"html": [
["class=(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2","[\"'`]([^]+)"]
],
[
"class=(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
],
"css": "\\B@apply\\s+([\\._a-zA-Z0-9\\s\\-\\:\\/]+);",
"javascript": [
[
"((?:class(?:Name)?|tw)\\s*=\\s*([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
[
"((?:class(?:Name)?|tw)\\s*=\\s*([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
],
"javascriptreact": [
[
"((?:class(?:Name)?|tw)\\s*=\\s*{?([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*{?(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
[
"((?:class(?:Name)?|tw)\\s*=\\s*{?([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*{?(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
],
"typescript": [
[
"((?:class(?:Name)?|tw)\\s*=\\s*([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
[
"((?:class(?:Name)?|tw)\\s*=\\s*([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
],
"typescriptreact": [
[
"((?:class(?:Name)?|tw)\\s*=\\s*{?([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*{?(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
[
"((?:class(?:Name)?|tw)\\s*=\\s*{?([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>]\\2)",
"(?:class(?:Name)?|tw)\\s*=\\s*{?(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
],
"php": [
["class=(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2","[\"'`]([^]+)"]
[
"class=(([\"'`])(?:(?:[^{}<>](?!\\2))|\\\\\\2)+[^{}<>])\\2",
"[\"'`]([^]+)"
]
]
},
"description": "An object with language IDs as keys and their values determining the regex to search for Tailwind CSS classes.",
Expand All @@ -118,7 +124,7 @@
"_esbuild": "node build.mjs",
"prebuild": "npm run _pre",
"build": "npm run _esbuild -- --minify",
"test": "mocha"
"test": "mocha"
},
"devDependencies": {
"@types/lodash": "^4.14.149",
Expand Down
1 change: 1 addition & 0 deletions src/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = import('./index.mjs');

0 comments on commit e40622e

Please sign in to comment.