Skip to content

Commit 2773033

Browse files
authored
feat: pass a node to the generateExportEntry option (#55)
1 parent ab8d7a1 commit 2773033

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/index.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,19 @@ const plugin = (options = {}) => {
9191
Once(root, { rule }) {
9292
const exports = Object.create(null);
9393

94-
function exportScopedName(name, rawName) {
94+
function exportScopedName(name, rawName, node) {
9595
const scopedName = generateScopedName(
9696
rawName ? rawName : name,
9797
root.source.input.from,
98-
root.source.input.css
98+
root.source.input.css,
99+
node
99100
);
100101
const exportEntry = generateExportEntry(
101102
rawName ? rawName : name,
102103
scopedName,
103104
root.source.input.from,
104-
root.source.input.css
105+
root.source.input.css,
106+
node
105107
);
106108
const { key, value } = exportEntry;
107109

@@ -123,14 +125,16 @@ const plugin = (options = {}) => {
123125
return selectorParser.className({
124126
value: exportScopedName(
125127
node.value,
126-
node.raws && node.raws.value ? node.raws.value : null
128+
node.raws && node.raws.value ? node.raws.value : null,
129+
node
127130
),
128131
});
129132
case "id": {
130133
return selectorParser.id({
131134
value: exportScopedName(
132135
node.value,
133-
node.raws && node.raws.value ? node.raws.value : null
136+
node.raws && node.raws.value ? node.raws.value : null,
137+
node
134138
),
135139
});
136140
}

0 commit comments

Comments
 (0)