webpack-inject-plugin
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -0,1 +1,18 @@ | ||
# v1.5.1 (Wed Jun 12 2019) | ||
#### 🐛 Bug Fix | ||
- fix: entryOrder First [#29](https://github.com/adierkens/webpack-inject-plugin/pull/29) ([@deini](https://github.com/deini)) | ||
#### 📝 Documentation | ||
- Add loaderID to README [#28](https://github.com/adierkens/webpack-inject-plugin/pull/28) ([@adierkens](https://github.com/adierkens)) | ||
#### Authors: 2 | ||
- Daniel Almaguer ([@deini](https://github.com/deini)) | ||
- Adam Dierkens ([@adierkens](https://github.com/adierkens)) | ||
--- | ||
# v1.5.0 (Thu Apr 25 2019) | ||
@@ -2,0 +19,0 @@ |
@@ -56,12 +56,12 @@ "use strict"; | ||
it('respects the config for ordering', function () { | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 0 /* First */ })).toEqual(['baz', 'foo', 'bar']); | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 1 /* Last */ })).toEqual(['foo', 'bar', 'baz']); | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 2 /* NotLast */ })).toEqual(['foo', 'baz', 'bar']); | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 1 /* First */ })).toEqual(['baz', 'foo', 'bar']); | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 2 /* Last */ })).toEqual(['foo', 'bar', 'baz']); | ||
expect(main_1.injectEntry(['foo', 'bar'], 'baz', { entryOrder: 3 /* NotLast */ })).toEqual(['foo', 'baz', 'bar']); | ||
}); | ||
it('order config for strings', function () { | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 0 /* First */ })).toEqual(['new', 'original']); | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 1 /* Last */ })).toEqual(['original', 'new']); | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 2 /* NotLast */ })).toEqual(['new', 'original']); | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 1 /* First */ })).toEqual(['new', 'original']); | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 2 /* Last */ })).toEqual(['original', 'new']); | ||
expect(main_1.injectEntry('original', 'new', { entryOrder: 3 /* NotLast */ })).toEqual(['new', 'original']); | ||
}); | ||
}); | ||
//# sourceMappingURL=main.test.js.map |
@@ -10,5 +10,5 @@ import { Compiler, Entry, EntryFunc } from 'webpack'; | ||
export declare const enum ENTRY_ORDER { | ||
First = 0, | ||
Last = 1, | ||
NotLast = 2 | ||
First = 1, | ||
Last = 2, | ||
NotLast = 3 | ||
} | ||
@@ -15,0 +15,0 @@ export interface IInjectOptions { |
@@ -15,7 +15,7 @@ "use strict"; | ||
function injectToArray(originalEntry, newEntry, entryOrder) { | ||
if (entryOrder === void 0) { entryOrder = 2 /* NotLast */; } | ||
if (entryOrder === 0 /* First */) { | ||
if (entryOrder === void 0) { entryOrder = 3 /* NotLast */; } | ||
if (entryOrder === 1 /* First */) { | ||
return [newEntry].concat(originalEntry); | ||
} | ||
if (entryOrder === 1 /* Last */) { | ||
if (entryOrder === 2 /* Last */) { | ||
return originalEntry.concat([newEntry]); | ||
@@ -72,3 +72,3 @@ } | ||
entryName: (options && options.entryName) || undefined, | ||
entryOrder: (options && options.entryOrder) || 2 /* NotLast */, | ||
entryOrder: (options && options.entryOrder) || 3 /* NotLast */, | ||
loaderID: (options && options.loaderID) || getUniqueID() | ||
@@ -75,0 +75,0 @@ }; |
{ | ||
"name": "webpack-inject-plugin", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A webpack plugin to dynamically inject code into the bundle.", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -68,2 +68,8 @@ # webpack-inject-plugin | ||
### options.loaderID | ||
> `string` | ||
An optional uniquie ID for the injected loader. If omitted, one will automatically be generated for you. | ||
## Additional Use Cases | ||
@@ -70,0 +76,0 @@ |
@@ -25,3 +25,3 @@ import { randomBytes } from 'crypto'; | ||
export const enum ENTRY_ORDER { | ||
First, | ||
First = 1, | ||
Last, | ||
@@ -28,0 +28,0 @@ NotLast |
30098
112