Skip to content

Commit

Permalink
fix(css-to-js): use const
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Jun 19, 2022
1 parent 9391000 commit 18e07f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/css-to-js/css-to-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ exports.transform = (file, processor, opts = {}) => {
const details = processor.files[file];
const { graph } = processor;

const relativeId = relative(processor.options.cwd, id);
const dependencies = new Set();

// Only want direct dependencies and any first-level dependencies
Expand Down Expand Up @@ -99,7 +98,7 @@ exports.transform = (file, processor, opts = {}) => {
// create import statements for all of the values used in compositions
dependencies.forEach((depKey) => {
const data = graph.getNodeData(depKey);
const { file: depFile } = data;
const { file : depFile } = data;

if(!importsMap.has(depFile)) {
importsMap.set(depFile, new Map());
Expand Down Expand Up @@ -165,7 +164,7 @@ exports.transform = (file, processor, opts = {}) => {
if(!imports.size) {
return;
}

const names = [ ...imports ].map(([ key, value ]) => esm(key, value));

out.push(`import { ${names.join(", ")} } from "${slash(from)}";`);
Expand Down Expand Up @@ -260,7 +259,7 @@ exports.transform = (file, processor, opts = {}) => {
}
throw new ReferenceError(
key + " is not exported by " + ${JSON.stringify(relativeId)}
key + " is not exported by " + ${JSON.stringify(relative(processor.options.cwd, id))}
);
}
})
Expand All @@ -282,7 +281,7 @@ exports.transform = (file, processor, opts = {}) => {
`));

if(options.styleExport) {
out.push(`export var styles = ${JSON.stringify(details.result.css)};`);
out.push(`export const styles = ${JSON.stringify(details.result.css)};`);
}

const code = out.join("\n");
Expand Down

0 comments on commit 18e07f8

Please sign in to comment.