diff --git a/package-lock.json b/package-lock.json index ead72a1..df5917b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "requires": true, "packages": { "": { - "version": "1.1.3", + "version": "1.2.0", "license": "MIT", "dependencies": { "postcss-selector-parser": "^6.0.4" @@ -33,6 +33,8 @@ "standard-version": "^9.0.0", "tailwindcss": "^2.0.3", "ts-node": "^9.0.0", + "ts-transform-default-export": "^1.0.3", + "ttypescript": "^1.5.12", "typedoc": "^0.19.0", "typescript": "^4.0.2" }, @@ -12051,6 +12053,15 @@ "node": ">=10.0.0" } }, + "node_modules/ts-transform-default-export": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-transform-default-export/-/ts-transform-default-export-1.0.3.tgz", + "integrity": "sha512-YDknVWAZtrmMNpSiJ5r2/pWmD2lYPSGZrfCj2GM44zBwgfpL7FyEgnGWSIqPf5ITkqEfsE2ewJsWBUrYv6x+0A==", + "dev": true, + "peerDependencies": { + "typescript": ">=3.0.0" + } + }, "node_modules/tsconfig-paths": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", @@ -12081,6 +12092,23 @@ "node": ">= 6" } }, + "node_modules/ttypescript": { + "version": "1.5.12", + "resolved": "https://registry.npmjs.org/ttypescript/-/ttypescript-1.5.12.tgz", + "integrity": "sha512-1ojRyJvpnmgN9kIHmUnQPlEV1gq+VVsxVYjk/NfvMlHSmYxjK5hEvOOU2MQASrbekTUiUM7pR/nXeCc8bzvMOQ==", + "dev": true, + "dependencies": { + "resolve": ">=1.9.0" + }, + "bin": { + "ttsc": "bin/tsc", + "ttsserver": "bin/tsserver" + }, + "peerDependencies": { + "ts-node": ">=8.0.2", + "typescript": ">=3.2.2" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -22219,6 +22247,13 @@ "yn": "3.1.1" } }, + "ts-transform-default-export": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-transform-default-export/-/ts-transform-default-export-1.0.3.tgz", + "integrity": "sha512-YDknVWAZtrmMNpSiJ5r2/pWmD2lYPSGZrfCj2GM44zBwgfpL7FyEgnGWSIqPf5ITkqEfsE2ewJsWBUrYv6x+0A==", + "dev": true, + "requires": {} + }, "tsconfig-paths": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", @@ -22246,6 +22281,15 @@ "tslib": "^1.8.1" } }, + "ttypescript": { + "version": "1.5.12", + "resolved": "https://registry.npmjs.org/ttypescript/-/ttypescript-1.5.12.tgz", + "integrity": "sha512-1ojRyJvpnmgN9kIHmUnQPlEV1gq+VVsxVYjk/NfvMlHSmYxjK5hEvOOU2MQASrbekTUiUM7pR/nXeCc8bzvMOQ==", + "dev": true, + "requires": { + "resolve": ">=1.9.0" + } + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 49f62c1..4f02710 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ ], "scripts": { "build": "run-p build:*", - "build:main": "tsc -p tsconfig.json", - "build:module": "tsc -p tsconfig.module.json", + "build:main": "ttsc -p tsconfig.json", + "build:module": "ttsc -p tsconfig.module.json", "fix": "run-s fix:*", "fix:prettier": "prettier \"src/**/*.ts\" --write", "fix:lint": "eslint src --ext .ts --fix", @@ -29,7 +29,7 @@ "check-cli": "run-s test diff-integration-tests check-integration-tests", "check-integration-tests": "run-s check-integration-test:*", "diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'", - "watch:build": "tsc -p tsconfig.json -w", + "watch:build": "ttsc -p tsconfig.json -w", "watch:test": "nyc --silent ava --watch", "cov": "run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html", "cov:html": "nyc report --reporter=html", @@ -77,6 +77,8 @@ "standard-version": "^9.0.0", "tailwindcss": "^2.0.3", "ts-node": "^9.0.0", + "ts-transform-default-export": "^1.0.3", + "ttypescript": "^1.5.12", "typedoc": "^0.19.0", "typescript": "^4.0.2" }, diff --git a/src/index.ts b/src/index.ts index b528a17..1c39fa2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import selectorParser, { Node } from 'postcss-selector-parser'; import plugin from 'tailwindcss/plugin'; -export default plugin(({ theme, addVariant, prefix, e: escape }) => { +const nestedGroupPlugin = plugin(({ theme, addVariant, prefix, e: escape }) => { const groupLevel = theme('groupLevel') || 10; const groupScope = theme('groupScope') || 'scope'; const groupVariants = theme('groupVariants') || ['hover', 'focus']; @@ -49,3 +49,5 @@ export default plugin(({ theme, addVariant, prefix, e: escape }) => { }); }); }); + +export default nestedGroupPlugin; diff --git a/tsconfig.json b/tsconfig.json index fbf1432..11ba98e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "incremental": true, - "target": "es2017", + "target": "ES3", "outDir": "build/main", "rootDir": "src", "moduleResolution": "node", @@ -40,7 +40,10 @@ "skipLibCheck": true, "lib": ["es2017"], "types": ["node"], - "typeRoots": ["node_modules/@types", "src/types"] + "typeRoots": ["node_modules/@types", "src/types"], + "plugins": [{ + "transform": "ts-transform-default-export", + }] }, "include": ["src/**/*.ts"], "exclude": ["node_modules/**"], diff --git a/tsconfig.module.json b/tsconfig.module.json index dfb74fa..be5abb2 100644 --- a/tsconfig.module.json +++ b/tsconfig.module.json @@ -3,7 +3,8 @@ "compilerOptions": { "target": "esnext", "outDir": "build/module", - "module": "esnext" + "module": "esnext", + "plugins": [] }, "exclude": [ "node_modules/**"