Skip to content

Commit

Permalink
feat: add deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Ellis committed Aug 23, 2020
1 parent 3d80200 commit 16fca16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Change Log
==========
### 3.5.0
- add some deprecation warnings for pre-4.0.0 changes

### 3.4.0
- clearCache now supports type inference
- you can now pass `publicPath: true` and it will use the `name` property of your app's `package.json` as the public path
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jpex",
"version": "3.4.0",
"version": "3.5.0",
"description": "Javascript Prototype Extension",
"main": "dist/cjs/jpex.js",
"module": "dist/es/jpex.js",
Expand Down
4 changes: 4 additions & 0 deletions src/resolver/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const resolveOne = <R extends any>(
stack: string[],
): R => {
if (isObject(name)) {
console.warn('jpex: $options style has been deprecated and will be removed in v4.0.0');
const key = Object.keys(name)[0];
return resolveOne(jpex, key, name[key], namedParameters, stack);
}
Expand All @@ -36,6 +37,7 @@ export const resolveOne = <R extends any>(
let optional = false;
const optionalCheck = checkOptional(name);
if (optionalCheck) {
console.warn('jpex: __ optional syntax has been deprecated and will be removed in v4.0.0');
name = optionalCheck;
optional = true;
}
Expand All @@ -51,6 +53,7 @@ export const resolveOne = <R extends any>(
switch (name) {
case '$options':
case jpex.infer<Options>():
console.warn('jpex: $options style has been deprecated and will be removed in v4.0.0');
return localOptions;
case '$namedParameters':
case jpex.infer<NamedParameters>():
Expand Down Expand Up @@ -127,6 +130,7 @@ export const resolveMany = <R extends any[]>(

const values = dependencies.reduce((value: Dependency[], dependency): Dependency[] => {
if (isObject(dependency)) {
console.warn('jpex: $options style has been deprecated and will be removed in v4.0.0');
const keys = Object.keys(dependency);
const x = keys.reduce((value, key) => {
const options = dependency[key];
Expand Down

0 comments on commit 16fca16

Please # to comment.