[postcss-modules-local-by-default] Add Typescript definitions. (#30625)

This commit is contained in:
Jeow Li Huan
2018-11-18 12:37:07 -08:00
committed by Pranav Senthilnathan
parent 76fca769df
commit b62bb72e6e
5 changed files with 70 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for postcss-modules-local-by-default 1.2
// Project: https://github.com/css-modules/postcss-modules-local-by-default
// 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 localByDefault {
interface Options {
mode?: "global" | "local" | "pure";
rewriteUrl?: (global: boolean, url: string) => string;
}
type LocalByDefault = Plugin<Options>;
}
declare const localByDefault: localByDefault.LocalByDefault;
export = localByDefault;
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"postcss": "7.x.x"
}
}
@@ -0,0 +1,21 @@
import localByDefault = require("postcss-modules-local-by-default");
import { Transformer } from "postcss";
const ap1: Transformer = localByDefault();
const ap2: Transformer = localByDefault({
mode: "global",
rewriteUrl: (global, url) => {
url = url.trim();
if (!url.replace(/\s/g, "").length) {
return url;
}
if (global) {
return url + "?request";
}
return url;
}
});
@@ -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-local-by-default-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }