Skip to content

Commit

Permalink
fix(dependencies): make compatible with Angular 7
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea authored and MarsiBarsi committed Sep 2, 2019
1 parent 064c763 commit 7b3963a
Show file tree
Hide file tree
Showing 8 changed files with 4,406 additions and 2,300 deletions.
6,648 changes: 4,377 additions & 2,271 deletions package-lock.json

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,27 @@
"bugs": "https://github.com/TinkoffCreditSystems/ng-dompurify/issues",
"homepage": "https://github.com/TinkoffCreditSystems/ng-dompurify#README",
"dependencies": {
"@angular/animations": "^8.2.0",
"@angular/common": "^8.2.0",
"@angular/compiler": "^8.2.0",
"@angular/core": "^8.2.0",
"@angular/forms": "^8.2.0",
"@angular/platform-browser": "^8.2.0",
"@angular/platform-browser-dynamic": "^8.2.0",
"@angular/router": "^8.2.0",
"@angular/animations": "^7.2.15",
"@angular/common": "^7.2.15",
"@angular/compiler": "^7.2.15",
"@angular/core": "^7.2.15",
"@angular/forms": "^7.2.15",
"@angular/platform-browser": "^7.2.15",
"@angular/platform-browser-dynamic": "^7.2.15",
"@angular/router": "^7.2.15",
"core-js": "^2.5.4",
"dompurify": "^1.0.11",
"rxjs": "^6.5.2",
"tslib": "^1.10.0",
"zone.js": "^0.10.1"
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.802.0",
"@angular-devkit/build-ng-packagr": "^0.802.0",
"@angular/cli": "^8.2.0",
"@angular/compiler-cli": "^8.2.0",
"@angular/language-service": "^8.2.0",
"@tinkoff/linters": "^0.3.0",
"@angular-devkit/build-angular": "~0.13.9",
"@angular-devkit/build-ng-packagr": "~0.13.9",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "^7.2.15",
"@angular/language-service": "^7.2.15",
"@tinkoff/linters": "^0.4.0",
"@types/dompurify": "^0.0.32",
"@types/jasmine": "^3.3.16",
"@types/jasminewd2": "^2.0.6",
Expand All @@ -70,13 +71,13 @@
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"lint-staged": "^9.2.1",
"ng-packagr": "^5.4.3",
"ng-packagr": "4.7.1",
"prettier": "^1.18.2",
"standard-version": "^7.0.0",
"ts-node": "^8.3.0",
"tsickle": "^0.36.0",
"tsickle": "0.34.0",
"tslint": "^5.18.0",
"typescript": "~3.4.5"
"typescript": "~3.2.2"
},
"husky": {
"hooks": {
Expand Down
7 changes: 5 additions & 2 deletions projects/ng-dompurify/src/lib/ng-dompurify.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {DOMPURIFY_CONFIG} from './tokens/dompurify-config';
import {DOMPURIFY_HOOKS} from './tokens/dompurify-hooks';
import {SANITIZE_STYLE} from './tokens/sanitize-style';
import {NgDompurifyConfig} from './types/ng-dompurify-config';
import {NgDompurifyHooks} from './types/ng-dompurify-hooks';
import {NgDompurifyHook} from './types/ng-dompurify-hook';
import {SanitizeStyle} from './types/sanitize-style';
import {createAfterSanitizeAttributes} from './utils/createAfterSanitizeAttributes';
import {createUponSanitizeElementHook} from './utils/createUponSanitizeElementHook';
Expand All @@ -15,6 +15,9 @@ import {createUponSanitizeElementHook} from './utils/createUponSanitizeElementHo
* use {@link DOMPURIFY_CONFIG} token to provide config ({@link NgDompurifyConfig})
* use {@link SANITIZE_STYLE} token to provide a style sanitizing method ({@link SanitizeStyle})
* use {@link DOMPURIFY_HOOKS} token to provide a hooks for DOMPurify ({@link addHook})
*
* Ambient type cannot be used without @dynamic https://github.com/angular/angular/issues/23395
* @dynamic
*/
@Injectable({
providedIn: 'root',
Expand All @@ -26,7 +29,7 @@ export class NgDompurifySanitizer extends Sanitizer {
@Inject(SANITIZE_STYLE)
private readonly sanitizeStyle: SanitizeStyle,
@Inject(DOMPURIFY_HOOKS)
hooks: NgDompurifyHooks,
hooks: ReadonlyArray<NgDompurifyHook>,
) {
super();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('NgDompurifyPipe', () => {
context?: SecurityContext = SecurityContext.HTML;
config? = {};

@ViewChild('element', {static: false})
@ViewChild('element')
readonly element!: ElementRef<HTMLElement>;

get html(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {removeAllHooks} from 'dompurify';
import {NgDompurifySanitizer} from '../ng-dompurify.service';
import {DOMPURIFY_HOOKS} from '../tokens/dompurify-hooks';
import {SANITIZE_STYLE} from '../tokens/sanitize-style';
import {NgDompurifyHooks} from '../types/ng-dompurify-hooks';
import {NgDompurifyHook} from '../types/ng-dompurify-hook';
import {cleanHtml, dirtyHtml} from './test-samples/html';
import {sanitizeStyle} from './test-samples/sanitizeStyle';
import {cleanStyleTag, dirtyStyleTag} from './test-samples/style';
import {cleanUrl, dirtyUrl} from './test-samples/url';

describe('NgDompurifySanitizer', () => {
const hooks: NgDompurifyHooks = [
const hooks: ReadonlyArray<NgDompurifyHook> = [
{
name: 'beforeSanitizeAttributes',
hook: (node: Element) => {
Expand Down
4 changes: 2 additions & 2 deletions projects/ng-dompurify/src/lib/tokens/dompurify-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {InjectionToken} from '@angular/core';
import {NgDompurifyHooks} from '../types/ng-dompurify-hooks';
import {NgDompurifyHook} from '../types/ng-dompurify-hook';

/**
* Token for adding hooks to DOMPurify, see {@link addHook}
*/
export const DOMPURIFY_HOOKS: InjectionToken<NgDompurifyHooks> = new InjectionToken<NgDompurifyHooks>(
export const DOMPURIFY_HOOKS = new InjectionToken<ReadonlyArray<NgDompurifyHook>>(
'Hooks for DOMPurify',
{
factory: () => [],
Expand Down
3 changes: 0 additions & 3 deletions projects/ng-dompurify/src/lib/types/ng-dompurify-hooks.ts

This file was deleted.

1 change: 0 additions & 1 deletion projects/ng-dompurify/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export * from './lib/tokens/sanitize-style';
export * from './lib/types/dompurify-hook';
export * from './lib/types/ng-dompurify-config';
export * from './lib/types/ng-dompurify-hook';
export * from './lib/types/ng-dompurify-hooks';
export * from './lib/types/sanitize-style';

0 comments on commit 7b3963a

Please sign in to comment.