Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to using loader-utils 1.0.0 #475

Merged
merged 5 commits into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ module.exports = {
}
```

For a full breakdown of the power of query syntax have a read of [this](https://github.com/webpack/loader-utils#parsequery).
For a full breakdown of the power of query syntax have a read of [this](https://github.com/webpack/loader-utils#getoptions).

#### Available Options

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"colors": "^1.0.3",
"enhanced-resolve": "^3.0.0",
"loader-utils": "^0.2.6",
"loader-utils": "^1.0.2",
"semver": "^5.0.1"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function loader(this: interfaces.Webpack, contents: string) {
this.cacheable && this.cacheable();
const callback = this.async();
const options = getLoaderOptions(this);

const { instance, error } = instances.getTypeScriptInstance(options, this);

if (error) {
Expand Down Expand Up @@ -63,7 +62,7 @@ function getLoaderOptions(loader: interfaces.Webpack) {
webpackIndex = webpackInstances.push(loader._compiler) - 1;
}

const queryOptions = loaderUtils.parseQuery<interfaces.LoaderOptions>(loader.query);
const queryOptions = loaderUtils.getOptions<interfaces.LoaderOptions>(loader) || {} as interfaces.LoaderOptions;
const configFileOptions: PartialLoaderOptions = loader.options.ts || {};

const instanceName = webpackIndex + '_' + (queryOptions.instance || configFileOptions.instance || 'default');
Expand Down
2 changes: 1 addition & 1 deletion src/typings/loaderUtils/loaderUtils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module 'loader-utils' {
export function parseQuery<T>(query: string): T;
export function getOptions<T>(loaderContext: { query: string; }): T;
export function getRemainingRequest(loaderContext: any): any;
export function getCurrentRequest(loaderContext: any): any;
}