css-modules-typescript-loader
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -66,3 +66,3 @@ const fs = require('fs'); | ||
const keyRegex = /"([^\\"]+)":/g; | ||
const keyRegex = /"([^\\"]+)":\s*"(?:[^\\"]+)",?$/gm; | ||
let match; | ||
@@ -69,0 +69,0 @@ const cssModuleKeys = []; |
{ | ||
"name": "css-modules-typescript-loader", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Webpack loader to create TypeScript declarations for CSS Modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,2 +6,3 @@ const path = require('path'); | ||
module.exports = (entry, options = {}) => { | ||
const { sourceMap, ...loaderOptions } = options; | ||
const compiler = webpack({ | ||
@@ -21,3 +22,3 @@ context: path.dirname(entry), | ||
loader: require.resolve('../index.js'), | ||
options | ||
options: loaderOptions | ||
}, | ||
@@ -27,3 +28,4 @@ { | ||
options: { | ||
modules: true | ||
modules: true, | ||
sourceMap: !!sourceMap | ||
} | ||
@@ -30,0 +32,0 @@ } |
const fs = require('fs'); | ||
const compiler = require('../compiler.js'); | ||
test('Can emit valid declaration', async () => { | ||
test('Can emit valid declaration without sourceMaps', async () => { | ||
await compiler(require.resolve('./index.js')); | ||
@@ -14,1 +14,24 @@ | ||
}); | ||
test('Can emit valid declaration with sourceMap', async () => { | ||
await compiler(require.resolve('./index.js'), { sourceMap: true }); | ||
const declaration = fs.readFileSync( | ||
require.resolve('./index.css.d.ts'), | ||
'utf-8' | ||
); | ||
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; | ||
" | ||
`); | ||
}); | ||
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
14338
264