mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
circular-dependency-plugin: Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import * as CircularDependencyPlugin from 'circular-dependency-plugin';
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
new CircularDependencyPlugin();
|
||||
new CircularDependencyPlugin({});
|
||||
|
||||
const MAX_CYCLES = 5;
|
||||
let numCyclesDetected = 0;
|
||||
|
||||
new CircularDependencyPlugin({
|
||||
allowAsyncCycles: false,
|
||||
cwd: process.cwd(),
|
||||
exclude: /a\.js|node_modules/,
|
||||
failOnError: true,
|
||||
onDetected({ module: webpackModuleRecord, paths, compilation }) {
|
||||
numCyclesDetected++;
|
||||
compilation.warnings.push(new Error(paths.join(' -> ')));
|
||||
},
|
||||
onStart({ compilation }) {
|
||||
numCyclesDetected = 0;
|
||||
},
|
||||
onEnd({ compilation }) {
|
||||
if (numCyclesDetected > MAX_CYCLES) {
|
||||
compilation.errors.push(new Error('Too many cycles'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
webpack({ plugins: [new CircularDependencyPlugin()] });
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for circular-dependency-plugin 5.0
|
||||
// Project: https://github.com/aackerman/circular-dependency-plugin
|
||||
// Definitions by: Olegs Jeremejevs <https://github.com/jeremejevs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin, Module, compilation } from 'webpack';
|
||||
|
||||
export = CircularDependencyPlugin;
|
||||
|
||||
declare class CircularDependencyPlugin extends Plugin {
|
||||
constructor(options?: CircularDependencyPlugin.Options);
|
||||
// Not exposing `isCyclic` because it isn't meant to be public, I believe
|
||||
}
|
||||
|
||||
declare namespace CircularDependencyPlugin {
|
||||
interface Options {
|
||||
allowAsyncCycles?: boolean;
|
||||
cwd?: string;
|
||||
exclude?: RegExp;
|
||||
failOnError?: boolean;
|
||||
onDetected?: (x: {
|
||||
module: Module;
|
||||
paths: string[];
|
||||
compilation: compilation.Compilation;
|
||||
}) => void;
|
||||
onEnd?: (x: { compilation: compilation.Compilation }) => void;
|
||||
onStart?: (x: { compilation: compilation.Compilation }) => void;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"circular-dependency-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user