css-modules-typescript-loader
Advanced tools
Comparing version 2.0.1 to 2.0.2
12
index.js
@@ -60,3 +60,3 @@ const fs = require('fs'); | ||
if (!validModes.includes(mode)) { | ||
return callback(new Error(`Invalid mode option: ${mode}`)); | ||
return failed(new Error(`Invalid mode option: ${mode}`)); | ||
} | ||
@@ -67,7 +67,13 @@ | ||
const keyRegex = /"([^\\"]+)":\s*"(?:[^\\"]+)",?$/gm; | ||
const keyRegex = /"([^\\"]+)":/g; | ||
let match; | ||
const cssModuleKeys = []; | ||
while ((match = keyRegex.exec(content))) { | ||
const localExports = content.split('exports.locals')[1]; | ||
if (!localExports) { | ||
return failed(new Error(`No exported locals found for ${filename}`)); | ||
} | ||
while ((match = keyRegex.exec(localExports))) { | ||
if (cssModuleKeys.indexOf(match[1]) < 0) { | ||
@@ -74,0 +80,0 @@ cssModuleKeys.push(match[1]); |
{ | ||
"name": "css-modules-typescript-loader", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Webpack loader to create TypeScript declarations for CSS Modules", | ||
@@ -40,3 +40,3 @@ "main": "index.js", | ||
"husky": "^1.1.2", | ||
"jest": "^23.6.0", | ||
"jest": "^24.7.1", | ||
"memory-fs": "^0.4.1", | ||
@@ -43,0 +43,0 @@ "semantic-release": "^15.9.17", |
@@ -23,15 +23,4 @@ const fs = require('fs'); | ||
expect(declaration).toMatchInlineSnapshot(` | ||
"// This file is automatically generated. | ||
// Please do not change this file! | ||
interface CssExports { | ||
'otherClass': string; | ||
'someClass': string; | ||
'validClass': string; | ||
} | ||
declare var cssExports: CssExports; | ||
export = cssExports; | ||
" | ||
`); | ||
expect(declaration).toMatchSnapshot(); | ||
}); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14716
27