@wessberg/di-compiler
Advanced tools
Comparing version 1.0.47 to 1.0.49
@@ -1,1 +0,2 @@ | ||
export { compile, getIntro, ICompileFileResult } from "./DI"; | ||
export { DICompiler } from "./di-compiler/di-compiler"; | ||
export { IDICompiler } from "./di-compiler/i-di-compiler"; |
@@ -1,2 +0,2 @@ | ||
export { compile, getIntro } from "./DI"; | ||
export { DICompiler } from "./di-compiler/di-compiler"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,2 @@ | ||
export { compile, getIntro, ICompileFileResult } from "./DI"; | ||
export { DICompiler } from "./di-compiler/di-compiler"; | ||
export { IDICompiler } from "./di-compiler/i-di-compiler"; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./DI"], factory); | ||
define(["require", "exports", "./di-compiler/di-compiler"], factory); | ||
} | ||
@@ -13,6 +13,5 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var DI_1 = require("./DI"); | ||
exports.compile = DI_1.compile; | ||
exports.getIntro = DI_1.getIntro; | ||
var di_compiler_1 = require("./di-compiler/di-compiler"); | ||
exports.DICompiler = di_compiler_1.DICompiler; | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@wessberg/di-compiler", | ||
"version": "1.0.47", | ||
"version": "1.0.49", | ||
"description": "The compiler for https://www.npmjs.com/package/@wessberg/di", | ||
@@ -46,17 +46,15 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/node": "^8.0.25", | ||
"@wessberg/di": "^1.0.22", | ||
"@types/node": "^8.0.26", | ||
"@wessberg/ts-config": "0.0.23", | ||
"ava": "^0.22.0", | ||
"conventional-changelog-cli": "latest", | ||
"conventional-changelog-cli": "^1.3.3", | ||
"husky": "latest", | ||
"tslint": "^5.7.0", | ||
"typescript": "^2.5.1" | ||
"typescript": "^2.5.2" | ||
}, | ||
"dependencies": { | ||
"@wessberg/codeanalyzer": "^1.0.61", | ||
"@wessberg/compiler-common": "^1.0.0", | ||
"@wessberg/globalobject": "^1.0.7", | ||
"@wessberg/type": "^0.0.81", | ||
"@wessberg/typedetector": "^1.0.6", | ||
"@types/chalk": "^0.4.31", | ||
"@wessberg/codeanalyzer": "^1.0.63", | ||
"@wessberg/type": "0.0.87", | ||
"chalk": "^2.1.0", | ||
"magic-string": "^0.22.4", | ||
@@ -63,0 +61,0 @@ "tslib": "^1.7.1" |
@@ -18,18 +18,19 @@ # DI-Compiler (The compiler for [DI](https://www.npmjs.com/package/@wessberg/di)) | ||
```typescript | ||
import {compile, getIntro} from "@wessberg/di-compiler"; | ||
import {DICompiler} from "@wessberg/di-compiler"; | ||
// The 'compile' method will upgrade all service registrations and 'get' calls | ||
// throughout the code | ||
const compiled = compile( | ||
"a_file.ts", ` | ||
class Foo implements IFoo {} | ||
DIContainer.registerSingleton<IFoo, Foo>(); | ||
`); | ||
// Instantiate the compiler | ||
const compiler = new DICompiler(); | ||
// The intro is a map between interface names and the constructor arguments | ||
// of their concrete implementations. Should only be injected once in your code | ||
// and at best in top of your bundle. | ||
const intro = getIntro(); | ||
// The 'compile' method will upgrade all 'registerSingleton', 'registerTransient', 'get' and 'has' calls throughout the code | ||
// and resolve the constructor arguments of all classes that matches the provided services | ||
const compiled = compiler.compile({ | ||
file: "a_file.ts", | ||
code: `class Foo implements IFoo {} | ||
DIContainer.registerSingleton<IFoo, Foo>();` | ||
}); | ||
compiled.code; // The updated code | ||
compiled.hasChanged; // is true if the source code was upgraded | ||
compiled.map // Holds a SourceMap reflecting the changes | ||
``` | ||
If you are using [Rollup](https://github.com/rollup/rollup), then use [rollup-plugin-di](https://github.com/wessberg/rollup-plugin-di) to compile your code automatically as part of your bundle, rather than using this compiler. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
125944
6
7
154
1849
35
1
+ Added@types/chalk@^0.4.31
+ Addedchalk@^2.1.0
+ Added@types/chalk@0.4.31(transitive)
+ Added@wessberg/type@0.0.87(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removed@wessberg/compiler-common@^1.0.0
- Removed@wessberg/globalobject@^1.0.7
- Removed@wessberg/typedetector@^1.0.6
- Removed@wessberg/compiler-common@1.0.0(transitive)
- Removed@wessberg/globalobject@1.0.7(transitive)
- Removed@wessberg/type@0.0.81(transitive)
- Removed@wessberg/typedetector@1.0.6(transitive)
- Removedtslib@2.8.1(transitive)
Updated@wessberg/type@0.0.87