Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-plugin-css-modules

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-plugin-css-modules - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

lib/helpers/createMatchers.d.ts

5

lib/helpers/cssExtensions.d.ts

@@ -1,2 +0,3 @@

export declare const isCSS: (fileName: string) => boolean;
export declare const isRelativeCSS: (fileName: string) => boolean;
export declare type isCSSFn = (fileName: string) => boolean;
export declare const createIsCSS: (customMatcher?: RegExp) => isCSSFn;
export declare const createIsRelativeCSS: (isCSS: isCSSFn) => (fileName: string) => boolean;

12

lib/helpers/cssExtensions.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DEFAULT_REGEXP = /\.module\.(sa|sc|c)ss$/;
var isRelative = function (fileName) { return /^\.\.?($|[\\/])/.test(fileName); };
exports.isCSS = function (fileName) {
return /\.module\.(sa|sc|c)ss$/.test(fileName);
exports.createIsCSS = function (customMatcher) {
if (customMatcher === void 0) { customMatcher = DEFAULT_REGEXP; }
return function (fileName) { return customMatcher.test(fileName); };
};
exports.isRelativeCSS = function (fileName) {
return exports.isCSS(fileName) && isRelative(fileName);
};
exports.createIsRelativeCSS = function (isCSS) { return function (fileName) {
return isCSS(fileName) && isRelative(fileName);
}; };
"use strict";
var path = require("path");
var ts_module = require("typescript/lib/tsserverlibrary");
var cssExtensions_1 = require("./helpers/cssExtensions");
var createMatchers_1 = require("./helpers/createMatchers");
var cssSnapshots_1 = require("./helpers/cssSnapshots");
function init(_a) {
var ts = _a.typescript;
var isCSS = cssExtensions_1.isCSS;
var _isCSS;
function create(info) {
// User options for plugin.
var options = info.config.options || {};
// Allow custom matchers to be used, handling bad matcher patterns;
try {
var customMatcher_1 = options.customMatcher;
if (customMatcher_1) {
isCSS = function (fileName) { return new RegExp(customMatcher_1).test(fileName); };
}
}
catch (e) {
// TODO: Provide error/warning to user.
}
// Create matchers using options object.
var _a = createMatchers_1.createMatchers(options), isCSS = _a.isCSS, isRelativeCSS = _a.isRelativeCSS;
_isCSS = isCSS;
// Creates new virtual source files for the CSS modules.

@@ -61,3 +54,3 @@ var _createLanguageServiceSourceFile = ts.createLanguageServiceSourceFile;

return moduleNames.map(function (moduleName, index) {
if (cssExtensions_1.isRelativeCSS(moduleName)) {
if (isRelativeCSS(moduleName)) {
return {

@@ -76,3 +69,3 @@ extension: ts_module.Extension.Dts,

function getExternalFiles(project) {
return project.getFileNames().filter(isCSS);
return project.getFileNames().filter(_isCSS);
}

@@ -79,0 +72,0 @@ return { create: create, getExternalFiles: getExternalFiles };

{
"name": "typescript-plugin-css-modules",
"version": "1.0.3",
"version": "1.0.4",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "author": "Brody McKee <mrmckeb@hotmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc