mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[postcss-modules-scope] Add Typescript definitions. (#30626)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
fb1c996762
commit
76fca769df
18
types/postcss-modules-scope/index.d.ts
vendored
Normal file
18
types/postcss-modules-scope/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for postcss-modules-scope 1.1
|
||||
// Project: https://github.com/css-modules/postcss-modules-scope
|
||||
// Definitions by: Jeow Li Huan <https://github.com/huan086>
|
||||
// Definitions: https://github.com/huan086/postcss-plugins-typings
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Plugin } from "postcss";
|
||||
|
||||
declare namespace scope {
|
||||
interface Options {
|
||||
generateScopedName?: (exportedName: string, path: string, css: string) => string;
|
||||
}
|
||||
|
||||
type Scope = Plugin<Options>;
|
||||
}
|
||||
|
||||
declare const scope: scope.Scope;
|
||||
export = scope;
|
||||
6
types/postcss-modules-scope/package.json
Normal file
6
types/postcss-modules-scope/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"postcss": "7.x.x"
|
||||
}
|
||||
}
|
||||
15
types/postcss-modules-scope/postcss-modules-scope-tests.ts
Normal file
15
types/postcss-modules-scope/postcss-modules-scope-tests.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import scope = require("postcss-modules-scope");
|
||||
import { Transformer } from "postcss";
|
||||
|
||||
const ap1: Transformer = scope();
|
||||
|
||||
const ap2: Transformer = scope({
|
||||
generateScopedName(exportedName, path, css) {
|
||||
if (css.substring(0, 7) === "@ignore") {
|
||||
return exportedName;
|
||||
}
|
||||
|
||||
const sanitisedPath = path.replace(/\.[^\.\/\\]+$/, "").replace(/[\W_]+/g, "_").replace(/^_|_$/g, "");
|
||||
return `_${sanitisedPath}__${exportedName}`;
|
||||
}
|
||||
});
|
||||
23
types/postcss-modules-scope/tsconfig.json
Normal file
23
types/postcss-modules-scope/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"postcss-modules-scope-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/postcss-modules-scope/tslint.json
Normal file
1
types/postcss-modules-scope/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user