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

typed-css-modules

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-css-modules - npm Package Compare versions

Comparing version 0.6.8 to 0.7.0

96

lib/cli.js

@@ -22,15 +22,7 @@ #!/usr/bin/env node

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const yargs = __importStar(require("yargs"));
const run_1 = require("./run");
const yarg = yargs.usage('Create .css.d.ts from CSS modules *.css files.\nUsage: $0 [options] <search directory>')
const yarg = yargs
.usage('Create .css.d.ts from CSS modules *.css files.\nUsage: $0 [options] <search directory>')
.example('$0 src/styles', '')

@@ -41,42 +33,54 @@ .example('$0 src -o dist', '')

.demand(['_'])
.alias('p', 'pattern').describe('p', 'Glob pattern with css files').string("p")
.alias('o', 'outDir').describe('o', 'Output directory').string("o")
.alias('w', 'watch').describe('w', 'Watch input directory\'s css files or pattern').boolean('w')
.alias('c', 'camelCase').describe('c', 'Convert CSS class tokens to camelcase').boolean("c")
.alias('e', 'namedExports').describe('e', 'Use named exports as opposed to default exports to enable tree shaking.').boolean("e")
.alias('d', 'dropExtension').describe('d', 'Drop the input files extension').boolean('d')
.alias('s', 'silent').describe('s', 'Silent output. Do not show "files written" messages').boolean('s')
.alias('h', 'help').help('h')
.alias('p', 'pattern')
.describe('p', 'Glob pattern with css files')
.string('p')
.alias('o', 'outDir')
.describe('o', 'Output directory')
.string('o')
.alias('w', 'watch')
.describe('w', "Watch input directory's css files or pattern")
.boolean('w')
.alias('c', 'camelCase')
.describe('c', 'Convert CSS class tokens to camelcase')
.boolean('c')
.alias('e', 'namedExports')
.describe('e', 'Use named exports as opposed to default exports to enable tree shaking.')
.boolean('e')
.alias('d', 'dropExtension')
.describe('d', 'Drop the input files extension')
.boolean('d')
.alias('s', 'silent')
.describe('s', 'Silent output. Do not show "files written" messages')
.boolean('s')
.alias('h', 'help')
.help('h')
.version(require('../package.json').version);
main();
function main() {
return __awaiter(this, void 0, void 0, function* () {
const argv = yarg.argv;
if (argv.h) {
yarg.showHelp();
return;
}
let searchDir;
if (argv._ && argv._[0]) {
searchDir = argv._[0];
}
else if (argv.p) {
searchDir = './';
}
else {
yarg.showHelp();
return;
}
yield run_1.run(searchDir, {
pattern: argv.p,
outDir: argv.o,
watch: argv.w,
camelCase: argv.c,
namedExports: argv.e,
dropExtension: argv.d,
silent: argv.s
});
async function main() {
const argv = yarg.argv;
if (argv.h) {
yarg.showHelp();
return;
}
let searchDir;
if (argv._ && argv._[0]) {
searchDir = argv._[0];
}
else if (argv.p) {
searchDir = './';
}
else {
yarg.showHelp();
return;
}
await run_1.run(searchDir, {
pattern: argv.p,
outDir: argv.o,
watch: argv.w,
camelCase: argv.c,
namedExports: argv.e,
dropExtension: argv.d,
silent: argv.s,
});
}
;
//# sourceMappingURL=cli.js.map

@@ -21,11 +21,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -72,15 +63,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

if (this.namedExports) {
return [
'export const __esModule: true;',
...this.resultList.map(line => 'export ' + line),
''
].join(os.EOL) + this.EOL;
return (['export const __esModule: true;', ...this.resultList.map(line => 'export ' + line), ''].join(os.EOL) + this.EOL);
}
return [
'declare const styles: {',
...this.resultList.map(line => ' ' + line),
'};',
'export = styles;',
''
].join(os.EOL) + this.EOL;
return (['declare const styles: {', ...this.resultList.map(line => ' ' + line), '};', 'export = styles;', ''].join(os.EOL) + this.EOL);
}

@@ -97,23 +78,21 @@ get tokens() {

}
writeFile(postprocessor = (formatted) => formatted) {
return __awaiter(this, void 0, void 0, function* () {
const finalOutput = postprocessor(this.formatted);
const outPathDir = path.dirname(this.outputFilePath);
if (!is_there_1.default(outPathDir)) {
mkdirp.sync(outPathDir);
}
let isDirty = false;
if (!is_there_1.default(this.outputFilePath)) {
async writeFile(postprocessor = (formatted) => formatted) {
const finalOutput = postprocessor(this.formatted);
const outPathDir = path.dirname(this.outputFilePath);
if (!is_there_1.default(outPathDir)) {
mkdirp.sync(outPathDir);
}
let isDirty = false;
if (!is_there_1.default(this.outputFilePath)) {
isDirty = true;
}
else {
const content = (await readFile(this.outputFilePath)).toString();
if (content !== finalOutput) {
isDirty = true;
}
else {
const content = (yield readFile(this.outputFilePath)).toString();
if (content !== finalOutput) {
isDirty = true;
}
}
if (isDirty) {
yield writeFile(this.outputFilePath, finalOutput, 'utf8');
}
});
}
if (isDirty) {
await writeFile(this.outputFilePath, finalOutput, 'utf8');
}
}

@@ -124,3 +103,3 @@ createResultList() {

.map(k => convertKey(k))
.map(k => !this.namedExports ? 'readonly "' + k + '": string;' : 'const ' + k + ': string;');
.map(k => (!this.namedExports ? 'readonly "' + k + '": string;' : 'const ' + k + ': string;'));
return result;

@@ -135,3 +114,3 @@ }

default:
return (key) => key;
return key => key;
}

@@ -138,0 +117,0 @@ }

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

import { DtsContent, CamelCaseOption } from "./dts-content";
import { Plugin } from "postcss";
import { DtsContent, CamelCaseOption } from './dts-content';
import { Plugin } from 'postcss';
interface DtsCreatorOptions {

@@ -4,0 +4,0 @@ rootDir?: string;

@@ -21,11 +21,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -56,35 +47,33 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

}
create(filePath, initialContents, clearCache = false) {
return __awaiter(this, void 0, void 0, function* () {
let rInputPath;
if (path.isAbsolute(filePath)) {
rInputPath = path.relative(this.inputDirectory, filePath);
}
else {
rInputPath = path.relative(this.inputDirectory, path.join(process.cwd(), filePath));
}
if (clearCache) {
this.loader.tokensByFile = {};
}
const res = yield this.loader.fetch(filePath, "/", undefined, initialContents);
if (res) {
const tokens = res;
const keys = Object.keys(tokens);
const content = new dts_content_1.DtsContent({
dropExtension: this.dropExtension,
rootDir: this.rootDir,
searchDir: this.searchDir,
outDir: this.outDir,
rInputPath,
rawTokenList: keys,
namedExports: this.namedExports,
camelCase: this.camelCase,
EOL: this.EOL
});
return content;
}
else {
throw res;
}
});
async create(filePath, initialContents, clearCache = false) {
let rInputPath;
if (path.isAbsolute(filePath)) {
rInputPath = path.relative(this.inputDirectory, filePath);
}
else {
rInputPath = path.relative(this.inputDirectory, path.join(process.cwd(), filePath));
}
if (clearCache) {
this.loader.tokensByFile = {};
}
const res = await this.loader.fetch(filePath, '/', undefined, initialContents);
if (res) {
const tokens = res;
const keys = Object.keys(tokens);
const content = new dts_content_1.DtsContent({
dropExtension: this.dropExtension,
rootDir: this.rootDir,
searchDir: this.searchDir,
outDir: this.outDir,
rInputPath,
rawTokenList: keys,
namedExports: this.namedExports,
camelCase: this.camelCase,
EOL: this.EOL,
});
return content;
}
else {
throw res;
}
}

@@ -91,0 +80,0 @@ }

import Core from 'css-modules-loader-core';
import { Plugin } from "postcss";
import { Plugin } from 'postcss';
declare type Dictionary<T> = {

@@ -4,0 +4,0 @@ [key: string]: T | undefined;

@@ -22,11 +22,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -49,55 +40,53 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

}
fetch(_newPath, relativeTo, _trace, initialContents) {
return __awaiter(this, void 0, void 0, function* () {
const newPath = _newPath.replace(/^["']|["']$/g, "");
const trace = _trace || String.fromCharCode(this.importNr++);
const relativeDir = path.dirname(relativeTo);
const rootRelativePath = path.resolve(relativeDir, newPath);
let fileRelativePath = path.resolve(path.join(this.root, relativeDir), newPath);
const isNodeModule = (fileName) => fileName[0] !== '.' && fileName[0] !== '/';
// if the path is not relative or absolute, try to resolve it in node_modules
if (isNodeModule(newPath)) {
try {
fileRelativePath = require.resolve(newPath);
}
catch (e) { }
async fetch(_newPath, relativeTo, _trace, initialContents) {
const newPath = _newPath.replace(/^["']|["']$/g, '');
const trace = _trace || String.fromCharCode(this.importNr++);
const relativeDir = path.dirname(relativeTo);
const rootRelativePath = path.resolve(relativeDir, newPath);
let fileRelativePath = path.resolve(path.join(this.root, relativeDir), newPath);
const isNodeModule = (fileName) => fileName[0] !== '.' && fileName[0] !== '/';
// if the path is not relative or absolute, try to resolve it in node_modules
if (isNodeModule(newPath)) {
try {
fileRelativePath = require.resolve(newPath);
}
let source;
if (!initialContents) {
const tokens = this.tokensByFile[fileRelativePath];
if (tokens) {
return tokens;
}
try {
source = yield readFile(fileRelativePath, "utf-8");
}
catch (error) {
if (relativeTo && relativeTo !== '/') {
return {};
}
throw error;
}
catch (e) { }
}
let source;
if (!initialContents) {
const tokens = this.tokensByFile[fileRelativePath];
if (tokens) {
return tokens;
}
else {
source = initialContents;
try {
source = await readFile(fileRelativePath, 'utf-8');
}
const { injectableSource, exportTokens } = yield this.core.load(source, rootRelativePath, trace, this.fetch.bind(this));
const re = new RegExp(/@import\s'(\D+?)';/, 'gm');
let importTokens = {};
let result;
while (result = re.exec(injectableSource)) {
const importFile = result === null || result === void 0 ? void 0 : result[1];
if (importFile) {
let importFilePath = isNodeModule(importFile) ?
importFile :
path.resolve(path.dirname(fileRelativePath), importFile);
const localTokens = yield this.fetch(importFilePath, relativeTo, undefined, initialContents);
Object.assign(importTokens, localTokens);
catch (error) {
if (relativeTo && relativeTo !== '/') {
return {};
}
throw error;
}
const tokens = Object.assign(Object.assign({}, exportTokens), importTokens);
this.sources[trace] = injectableSource;
this.tokensByFile[fileRelativePath] = tokens;
return tokens;
});
}
else {
source = initialContents;
}
const { injectableSource, exportTokens } = await this.core.load(source, rootRelativePath, trace, this.fetch.bind(this));
const re = new RegExp(/@import\s'(\D+?)';/, 'gm');
let importTokens = {};
let result;
while ((result = re.exec(injectableSource))) {
const importFile = result === null || result === void 0 ? void 0 : result[1];
if (importFile) {
let importFilePath = isNodeModule(importFile)
? importFile
: path.resolve(path.dirname(fileRelativePath), importFile);
const localTokens = await this.fetch(importFilePath, relativeTo, undefined, initialContents);
Object.assign(importTokens, localTokens);
}
}
const tokens = { ...exportTokens, ...importTokens };
this.sources[trace] = injectableSource;
this.tokensByFile[fileRelativePath] = tokens;
return tokens;
}

@@ -104,0 +93,0 @@ }

@@ -21,11 +21,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -43,44 +34,40 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

const glob = util.promisify(glob_1.default);
function run(searchDir, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const filesPattern = path.join(searchDir, options.pattern || '**/*.css');
const creator = new dts_creator_1.DtsCreator({
rootDir: process.cwd(),
searchDir,
outDir: options.outDir,
camelCase: options.camelCase,
namedExports: options.namedExports,
dropExtension: options.dropExtension,
});
const writeFile = (f) => __awaiter(this, void 0, void 0, function* () {
try {
const content = yield creator.create(f, undefined, !!options.watch);
yield content.writeFile();
if (!options.silent) {
console.log('Wrote ' + chalk_1.default.green(content.outputFilePath));
}
async function run(searchDir, options = {}) {
const filesPattern = path.join(searchDir, options.pattern || '**/*.css');
const creator = new dts_creator_1.DtsCreator({
rootDir: process.cwd(),
searchDir,
outDir: options.outDir,
camelCase: options.camelCase,
namedExports: options.namedExports,
dropExtension: options.dropExtension,
});
const writeFile = async (f) => {
try {
const content = await creator.create(f, undefined, !!options.watch);
await content.writeFile();
if (!options.silent) {
console.log('Wrote ' + chalk_1.default.green(content.outputFilePath));
}
catch (error) {
console.error(chalk_1.default.red('[Error] ' + error));
}
});
if (!options.watch) {
const files = yield glob(filesPattern);
yield Promise.all(files.map(writeFile));
}
else {
console.log('Watch ' + filesPattern + '...');
const watcher = chokidar.watch([filesPattern.replace(/\\/g, "/")]);
watcher.on('add', writeFile);
watcher.on('change', writeFile);
yield waitForever();
catch (error) {
console.error(chalk_1.default.red('[Error] ' + error));
}
});
};
if (!options.watch) {
const files = await glob(filesPattern);
await Promise.all(files.map(writeFile));
}
else {
console.log('Watch ' + filesPattern + '...');
const watcher = chokidar.watch([filesPattern.replace(/\\/g, '/')]);
watcher.on('add', writeFile);
watcher.on('change', writeFile);
await waitForever();
}
}
exports.run = run;
function waitForever() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(() => { });
});
async function waitForever() {
return new Promise(() => { });
}
//# sourceMappingURL=run.js.map
{
"name": "typed-css-modules",
"version": "0.6.8",
"version": "0.7.0",
"description": "Creates .d.ts files from CSS Modules .css files",

@@ -10,6 +10,12 @@ "main": "lib/index.js",

"build": "npm run clean && tsc && chmod +x lib/cli.js",
"prettier": "prettier \"*.{md,js,json.yml,yaml}\" \"{src,test}/**/*\"",
"format": "npm run prettier -- --write",
"lint": "npm run prettier -- --check",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --coverage",
"prepublish": "npm run build"
"prepublish": "npm run build",
"_postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable"
},

@@ -30,3 +36,3 @@ "bin": {

"engines": {
"node": ">=8.0.0"
"node": ">=12.0.0"
},

@@ -41,14 +47,18 @@ "dependencies": {

"is-there": "^4.4.2",
"mkdirp": "^0.5.1",
"yargs": "^15.3.1"
"mkdirp": "^1.0.0",
"yargs": "^15.4.1"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^26.0.22",
"@types/mkdirp": "^0.5.1",
"@types/node": "^14.14.37",
"@types/yargs": "^15.0.4",
"jest": "^26.6.3",
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
"@types/glob": "7.1.3",
"@types/jest": "26.0.22",
"@types/mkdirp": "1.0.1",
"@types/node": "14.14.37",
"@types/yargs": "15.0.4",
"husky": "6.0.0",
"jest": "27.0.3",
"pinst": "2.1.6",
"prettier": "2.3.0",
"pretty-quick": "3.1.0",
"ts-jest": "27.0.2",
"typescript": "4.3.2"
},

@@ -55,0 +65,0 @@ "jest": {

@@ -22,4 +22,4 @@ # typed-css-modules [![github actions](https://github.com/Quramy/typed-css-modules/workflows/build/badge.svg)](https://github.com/Quramy/typed-css-modules/actions) [![npm version](https://badge.fury.io/js/typed-css-modules.svg)](http://badge.fury.io/js/typed-css-modules)

declare const styles: {
readonly "primary": string;
readonly "myClass": string;
readonly primary: string;
readonly myClass: string;
};

@@ -61,2 +61,3 @@ export = styles;

#### output directory
Use `-o` or `--outDir` option.

@@ -89,8 +90,9 @@

#### watch
With `-w` or `--watch`, this CLI watches files in the input directory.
#### camelize CSS token
With `-c` or `--camelCase`, kebab-cased CSS classes(such as `.my-class {...}`) are exported as camelized TypeScript varibale name(`export const myClass: string`).
You can pass `--camelCase dashes` to only camelize dashes in the class name. Since version `0.27.1` in the

@@ -109,3 +111,3 @@ webpack `css-loader`. This will keep upperCase class names intact, e.g.:

declare const styles: {
readonly "SomeComponent": string;
readonly SomeComponent: string;
};

@@ -118,2 +120,3 @@ export = styles;

#### named exports (enable tree shaking)
With `-e` or `--namedExports`, types are exported as named exports as opposed to default exports.

@@ -126,3 +129,3 @@ This enables support for the `namedExports` css-loader feature, required for webpack to tree shake the final CSS (learn more [here](https://webpack.js.org/loaders/css-loader/#namedexport)).

*NOTE: this option enables camelcase by default.*
_NOTE: this option enables camelcase by default._

@@ -139,3 +142,3 @@ ```css

declare const styles: {
readonly "SomeComponent": string;
readonly SomeComponent: string;
};

@@ -161,5 +164,5 @@ export = styles;

creator.create('src/style.css').then(content => {
console.log(content.tokens); // ['myClass']
console.log(content.formatted); // 'export const myClass: string;'
content.writeFile(); // writes this content to "src/style.css.d.ts"
console.log(content.tokens); // ['myClass']
console.log(content.formatted); // 'export const myClass: string;'
content.writeFile(); // writes this content to "src/style.css.d.ts"
});

@@ -169,27 +172,32 @@ ```

### class DtsCreator
DtsCreator instance processes the input CSS and create TypeScript definition contents.
#### `new DtsCreator(option)`
You can set the following options:
* `option.rootDir`: Project root directory(default: `process.cwd()`).
* `option.searchDir`: Directory which includes target `*.css` files(default: `'./'`).
* `option.outDir`: Output directory(default: `option.searchDir`).
* `option.camelCase`: Camelize CSS class tokens.
* `option.namedExports`: Use named exports as opposed to default exports to enable tree shaking. Requires `import * as style from './file.module.css';` (default: `false`)
* `option.EOL`: EOL (end of line) for the generated `d.ts` files. Possible values `'\n'` or `'\r\n'`(default: `os.EOL`).
- `option.rootDir`: Project root directory(default: `process.cwd()`).
- `option.searchDir`: Directory which includes target `*.css` files(default: `'./'`).
- `option.outDir`: Output directory(default: `option.searchDir`).
- `option.camelCase`: Camelize CSS class tokens.
- `option.namedExports`: Use named exports as opposed to default exports to enable tree shaking. Requires `import * as style from './file.module.css';` (default: `false`)
- `option.EOL`: EOL (end of line) for the generated `d.ts` files. Possible values `'\n'` or `'\r\n'`(default: `os.EOL`).
#### `create(filepath, contents) => Promise(dtsContent)`
Returns `DtsContent` instance.
* `filepath`: path of target .css file.
* `contents`(optional): the CSS content of the `filepath`. If set, DtsCreator uses the contents instead of the original contents of the `filepath`.
- `filepath`: path of target .css file.
- `contents`(optional): the CSS content of the `filepath`. If set, DtsCreator uses the contents instead of the original contents of the `filepath`.
### class DtsContent
DtsContent instance has `*.d.ts` content, final output path, and function to write file.
#### `writeFile(postprocessor) => Promise(dtsContent)`
Writes the DtsContent instance's content to a file. Returns the DtsContent instance.
* `postprocessor` (optional): a function that takes the formatted definition string and returns a modified string that will be the final content written to the file.
- `postprocessor` (optional): a function that takes the formatted definition string and returns a modified string that will be the final content written to the file.

@@ -199,8 +207,7 @@ You could use this, for example, to pass generated definitions through a formatter like Prettier, or to add a comment to the top of generated files:

```js
dtsContent.writeFile(
definition => `// Generated automatically, do not edit\n${definition}`
)
dtsContent.writeFile(definition => `// Generated automatically, do not edit\n${definition}`);
```
#### `tokens`
An array of tokens retrieved from input CSS file.

@@ -210,2 +217,3 @@ e.g. `['myClass']`

#### `contents`
An array of TypeScript definition expressions.

@@ -215,2 +223,3 @@ e.g. `['export const myClass: string;']`.

#### `formatted`
A string of TypeScript definition expression.

@@ -225,2 +234,3 @@

#### `messageList`
An array of messages. The messages contains invalid token information.

@@ -230,5 +240,7 @@ e.g. `['my-class is not valid TypeScript variable name.']`.

#### `outputFilePath`
Final output file path.
## Remarks
If your input CSS file has the following class names, these invalid tokens are not written to output `.d.ts` file.

@@ -244,3 +256,3 @@

/* If camelCase option is set, this token will be converted to 'myClass' */
.my-class{
.my-class {
color: red;

@@ -256,2 +268,3 @@ }

## Example
There is a minimum example in this repository `example` folder. Clone this repository and run `cd example; npm i; npm start`.

@@ -262,2 +275,3 @@

## License
This software is released under the MIT License, see LICENSE.txt.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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