Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngmeta

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngmeta - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

dist/bundles/ngmeta.umd.js

6

CHANGELOG.md

@@ -0,4 +1,8 @@

# 1.2.1 (2017-07-05)
* Prerendering bug fixes.
# 1.2.0 (2017-07-05)
* Update for support of Angular 4
* Update for support of Angular 4.

@@ -5,0 +9,0 @@ # 1.1.0 (2017-02-28)

5

dist/index.d.ts

@@ -1,2 +0,3 @@

export * from "./ngmeta.service";
export * from "./tag-data.interface";
export * from './ngmeta.module';
export * from './ngmeta.service';
export * from './tag-data.interface';

@@ -1,6 +0,3 @@

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./ngmeta.service"));
export * from './ngmeta.module';
export * from './ngmeta.service';
//# sourceMappingURL=index.js.map
import { Router } from '@angular/router';
import { TagData, MetaData } from './tag-data.interface';
/**
* Service that allows setting and updating of meta tags, title tags, and canonical tags.
* @class NGMeta
* @constructor
*/
export declare class NGMeta {
private _router;
private _document;
private _router;
private _dom;
private _scrollEnabled;
constructor(_document: any, _router: Router);
/**
* Initializes service. Creates faux DOM component to abstractly interact with DOM. Subscribes to route events.
* @method constructor
*/
constructor(_router: Router);
/**
* Sets canonical tag for page, to call `this._ngmeta.canonical = 'https://www.google.com';`.
* @public
* @method canonical
* @param {string} canonicalURL Canonical URL for the page.
*/
canonical: string;
/**
* Returns string value of current page's title, to call `let title: string = this._ngmeta.title;`.
* @public
* @method title
* @return {string} Current page's title.
*/
/**
* Sets `<title></title>` tag for page, to call `this._ngmeta.title = 'Google';`.
* @public
* @method title
* @param {string} title Title value for the page.
*/
title: string;
/**
* Returns boolean value if scroll to top is enabled, to call `let scrollEnabled: boolean = this._ngmeta.scrollEnabled;`.
* @public
* @method scrollEnabled
* @return {boolean} If scroll to top is enabled.
*/
/**
* Sets wether `<body></body>` should scroll to top on route change, to call `this._ngmeta.scrollEnabled = true;`.
* @public
* @method scrollEnabled
* @param {Boolean} scroll If `<body></body>` should scroll.
*/
scrollEnabled: boolean;
/**
* Creates HTML for a `<meta>` tag of any attribute.
* @public
* @method createMeta
* @param {MetaData} metaData The attribute (like 'name' or 'property') type (like 'description' or 'og:title') and content of the tag.
*/
createMeta(metaData: MetaData): void;
/**
* Set function setting all `<head></head>` metadata.
* @public
* @method setHead
* @param {TagData} tagData An object of the new values for the tags an user wants.
* @throws {Error} An error.
*/
setHead(tagData: TagData): void;
/**
* Removes HTML from `<head></head>` for a tag.
* @private
* @method _removeTag
* @param {String} tagSelector Selector detail for tag to remove.
*/
private _removeTag(tagSelector);
/**
* Scrolls web page to top of `<body></body>`.
* @private
* @method _scrollToTop
* @param {Number} duration Duration in time for scroll to top of page.
*/
private _scrollToTop(evt);
}

@@ -1,25 +0,20 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var platform_browser_1 = require("@angular/platform-browser");
var router_1 = require("@angular/router");
import { Injectable } from '@angular/core';
import { ɵgetDOM as getDOM } from '@angular/platform-browser';
import { Router, NavigationEnd } from '@angular/router';
/**
* Service that allows setting and updating of meta tags, title tags, and canonical tags.
* @class NGMeta
* @constructor
*/
var NGMeta = (function () {
function NGMeta(_document, _router) {
/**
* Initializes service. Creates faux DOM component to abstractly interact with DOM. Subscribes to route events.
* @method constructor
*/
function NGMeta(_router) {
var _this = this;
this._document = _document;
this._router = _router;
this._dom = platform_browser_1.ɵgetDOM();
this._dom = getDOM();
this._scrollEnabled = true;
this._document = document;
this._router.events.subscribe(function (evt) {

@@ -30,2 +25,8 @@ _this._scrollToTop(evt);

Object.defineProperty(NGMeta.prototype, "canonical", {
/**
* Sets canonical tag for page, to call `this._ngmeta.canonical = 'https://www.google.com';`.
* @public
* @method canonical
* @param {string} canonicalURL Canonical URL for the page.
*/
set: function (canonicalURL) {

@@ -44,2 +45,8 @@ try {

Object.defineProperty(NGMeta.prototype, "title", {
/**
* Returns string value of current page's title, to call `let title: string = this._ngmeta.title;`.
* @public
* @method title
* @return {string} Current page's title.
*/
get: function () {

@@ -49,4 +56,12 @@ try {

}
catch (e) { }
catch (e) {
return '';
}
},
/**
* Sets `<title></title>` tag for page, to call `this._ngmeta.title = 'Google';`.
* @public
* @method title
* @param {string} title Title value for the page.
*/
set: function (title) {

@@ -62,5 +77,17 @@ try {

Object.defineProperty(NGMeta.prototype, "scrollEnabled", {
/**
* Returns boolean value if scroll to top is enabled, to call `let scrollEnabled: boolean = this._ngmeta.scrollEnabled;`.
* @public
* @method scrollEnabled
* @return {boolean} If scroll to top is enabled.
*/
get: function () {
return this._scrollEnabled;
},
/**
* Sets wether `<body></body>` should scroll to top on route change, to call `this._ngmeta.scrollEnabled = true;`.
* @public
* @method scrollEnabled
* @param {Boolean} scroll If `<body></body>` should scroll.
*/
set: function (scroll) {

@@ -72,2 +99,8 @@ this._scrollEnabled = scroll;

});
/**
* Creates HTML for a `<meta>` tag of any attribute.
* @public
* @method createMeta
* @param {MetaData} metaData The attribute (like 'name' or 'property') type (like 'description' or 'og:title') and content of the tag.
*/
NGMeta.prototype.createMeta = function (metaData) {

@@ -84,7 +117,16 @@ try {

};
/**
* Set function setting all `<head></head>` metadata.
* @public
* @method setHead
* @param {TagData} tagData An object of the new values for the tags an user wants.
* @throws {Error} An error.
*/
NGMeta.prototype.setHead = function (tagData) {
try {
// Edit <title>
if (typeof tagData.title === 'string') {
this.title = tagData.title;
}
// Edit meta tags with Name attribute
if (tagData.name instanceof Array) {

@@ -97,2 +139,3 @@ for (var _i = 0, _a = tagData.name; _i < _a.length; _i++) {

}
// Edit meta tags with Property attribute
if (tagData.property instanceof Array) {

@@ -105,2 +148,3 @@ for (var _b = 0, _c = tagData.property; _b < _c.length; _b++) {

}
// Edit meta tags with any attribute
if (tagData.meta instanceof Array) {

@@ -112,2 +156,3 @@ for (var _d = 0, _e = tagData.meta; _d < _e.length; _d++) {

}
// Edit canonical tag
if (typeof tagData.canonical === 'string') {

@@ -121,2 +166,8 @@ this.canonical = tagData.canonical;

};
/**
* Removes HTML from `<head></head>` for a tag.
* @private
* @method _removeTag
* @param {String} tagSelector Selector detail for tag to remove.
*/
NGMeta.prototype._removeTag = function (tagSelector) {

@@ -129,4 +180,10 @@ try {

};
/**
* Scrolls web page to top of `<body></body>`.
* @private
* @method _scrollToTop
* @param {Number} duration Duration in time for scroll to top of page.
*/
NGMeta.prototype._scrollToTop = function (evt) {
if (!(evt instanceof router_1.NavigationEnd) || evt.url.includes('#') || !this.scrollEnabled) {
if (!(evt instanceof NavigationEnd) || evt.url.includes('#') || !this.scrollEnabled) {
return;

@@ -138,7 +195,10 @@ }

}());
NGMeta = __decorate([
core_1.Injectable(),
__param(0, core_1.Inject(platform_browser_1.DOCUMENT)),
__metadata("design:paramtypes", [Object, router_1.Router])
], NGMeta);
exports.NGMeta = NGMeta;
export { NGMeta };
NGMeta.decorators = [
{ type: Injectable },
];
/** @nocollapse */
NGMeta.ctorParameters = function () { return [
{ type: Router, },
]; };
//# sourceMappingURL=ngmeta.service.js.map

@@ -0,1 +1,4 @@

/**
* Interface for an the TagData interface.
*/
export interface MetaData {

@@ -6,2 +9,5 @@ type: string;

}
/**
* Interface for an object that is used with the 'setHead()' function.
*/
export interface TagData {

@@ -8,0 +14,0 @@ title?: string;

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=tag-data.interface.js.map
{
"name": "ngmeta",
"version": "1.2.0",
"version": "1.2.1",
"lockfileVersion": 1,

@@ -12,2 +12,14 @@ "dependencies": {

},
"@angular/compiler": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.2.5.tgz",
"integrity": "sha1-tIZ0x0VrKw3xBy1w5OZnr4bN34M=",
"dev": true
},
"@angular/compiler-cli": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.2.5.tgz",
"integrity": "sha1-OzltZa3oOA83EgHUNh/JYqSax2o=",
"dev": true
},
"@angular/core": {

@@ -30,80 +42,13 @@ "version": "4.2.5",

},
"@types/rx": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz",
"integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=",
"@angular/tsc-wrapped": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.5.tgz",
"integrity": "sha1-Ci/CMwYXgNK+QCmWGHh4wng4t+M=",
"dev": true
},
"@types/rx-core": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-core/-/rx-core-4.0.3.tgz",
"integrity": "sha1-CzNUsSOM7b4rdPYybxOdvHpZHWA=",
"dev": true
"@types/core-js": {
"version": "0.9.42",
"resolved": "https://registry.npmjs.org/@types/core-js/-/core-js-0.9.42.tgz",
"integrity": "sha512-AiEZz42jF2f4nkcJ2OhKWxIbXU62pEHmFoaGoGo83seUzDEncxEZtBPX2i2DLUpcVpaVVxAsqAAZzTyrV0A/RQ=="
},
"@types/rx-core-binding": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz",
"integrity": "sha512-5pkfxnC4w810LqBPUwP5bg7SFR/USwhMSaAeZQQbEHeBp57pjKXRlXmqpMrLJB4y1oglR/c2502853uN0I+DAQ==",
"dev": true
},
"@types/rx-lite": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/rx-lite/-/rx-lite-4.0.4.tgz",
"integrity": "sha1-cQ6/idCi1ZbCEEfZGxJCvO9Rwws=",
"dev": true
},
"@types/rx-lite-aggregates": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz",
"integrity": "sha512-MAGDAHy8cRatm94FDduhJF+iNS5//jrZ/PIfm+QYw9OCeDgbymFHChM8YVIvN2zArwsRftKgE33QfRWvQk4DPg==",
"dev": true
},
"@types/rx-lite-async": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz",
"integrity": "sha512-vTEv5o8l6702ZwfAM5aOeVDfUwBSDOs+ARoGmWAKQ6LOInQ8J4/zjM7ov12fuTpktUKdMQjkeCp07Vd73mPkxw==",
"dev": true
},
"@types/rx-lite-backpressure": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz",
"integrity": "sha512-Y6aIeQCtNban5XSAF4B8dffhIKu6aAy/TXFlScHzSxh6ivfQBQw6UjxyEJxIOt3IT49YkS+siuayM2H/Q0cmgA==",
"dev": true
},
"@types/rx-lite-coincidence": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz",
"integrity": "sha512-1VNJqzE9gALUyMGypDXZZXzR0Tt7LC9DdAZQ3Ou/Q0MubNU35agVUNXKGHKpNTba+fr8GdIdkC26bRDqtCQBeQ==",
"dev": true
},
"@types/rx-lite-experimental": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz",
"integrity": "sha1-xTL1y98/LBXaFt7Ykw0bKYQCPL0=",
"dev": true
},
"@types/rx-lite-joinpatterns": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz",
"integrity": "sha1-9w/jcFGKhDLykVjMkv+1a05K/D4=",
"dev": true
},
"@types/rx-lite-testing": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz",
"integrity": "sha1-IbGdEfTf1v/vWp0WSOnIh5v+Iek=",
"dev": true
},
"@types/rx-lite-time": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz",
"integrity": "sha512-ukO5sPKDRwCGWRZRqPlaAU0SKVxmWwSjiOrLhoQDoWxZWg6vyB9XLEZViKOzIO6LnTIQBlk4UylYV0rnhJLxQw==",
"dev": true
},
"@types/rx-lite-virtualtime": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz",
"integrity": "sha512-3uC6sGmjpOKatZSVHI2xB1+dedgml669ZRvqxy+WqmGJDVusOdyxcKfyzjW0P3/GrCiN4nmRkLVMhPwHCc5QLg==",
"dev": true
},
"ansi-regex": {

@@ -127,2 +72,13 @@ "version": "2.1.1",

},
"commander": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
"integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
"dev": true
},
"core-js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
"integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4="
},
"escape-string-regexp": {

@@ -134,2 +90,8 @@ "version": "1.0.5",

},
"graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
"dev": true
},
"has-ansi": {

@@ -141,2 +103,33 @@ "version": "2.0.0",

},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
}
},
"reflect-metadata": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz",
"integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo="
},
"rollup": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-0.43.0.tgz",
"integrity": "sha512-XqpEPAMHCJ4VcT95ApyGQC7MncjGcG6UtcU5geONqPfN2uAROGmJDE3cOi325S19rhklbM+BXIHNX35l+1zmAg==",
"dev": true
},
"rxjs": {

@@ -148,2 +141,14 @@ "version": "5.4.2",

},
"source-map": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=",
"dev": true
},
"source-map-support": {
"version": "0.4.15",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz",
"integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=",
"dev": true
},
"strip-ansi": {

@@ -167,2 +172,8 @@ "version": "3.0.1",

},
"tsickle": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.21.6.tgz",
"integrity": "sha1-U7Abl5xcE/2xOvs/uVgXflmRWI0=",
"dev": true
},
"tslib": {

@@ -179,2 +190,8 @@ "version": "1.7.1",

},
"uglify-js": {
"version": "3.0.23",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.0.23.tgz",
"integrity": "sha512-miLHbO2QcdQGxL/q1wLcUr6TGIRHhMnpKyywUbAdZRkJMqCeZCDmBsgYu1Wlj26xHBXN+sU5tHaWh38QsN208g==",
"dev": true
},
"zone.js": {

@@ -181,0 +198,0 @@ "version": "0.8.12",

{
"name": "ngmeta",
"version": "1.2.0",
"version": "1.2.1",
"description": "A tool for updating meta tags in an Angular application.",

@@ -8,3 +8,6 @@ "main": "dist/index.js",

"scripts": {
"build": "tsc",
"transpile": "ngc",
"package": "rollup -c",
"minify": "uglifyjs dist/bundles/ngmeta.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/ngmeta.umd.min.js",
"build": "npm run transpile && npm run package && npm run minify",
"documentation": "yuidoc . -c yuidoc.json",

@@ -40,7 +43,11 @@ "start": "npm build",

"@angular/common": "^4.0.0",
"@angular/compiler": "^4.2.5",
"@angular/compiler-cli": "^4.2.5",
"@angular/core": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"chalk": "^1.1.3",
"rollup": "^0.43.0",
"rxjs": "^5.1.0",
"typescript": "~2.3.3",
"typescript": "^2.3.4",
"uglify-js": "^3.0.23",
"zone.js": "^0.8.4"

@@ -47,0 +54,0 @@ },

var chalk = require('chalk');
console.log(chalk.underline.bold.green("ngmeta 1.20"));
console.log(chalk.underline.bold.green("ngmeta 1.2.1"));
console.log(chalk.bold.yellow("CHANGELOG -> https://github.com/MichaelSolati/ngmeta/blob/master/CHANGELOG.md"));

@@ -1,2 +0,3 @@

export * from "./ngmeta.service";
export * from "./tag-data.interface";
export * from './ngmeta.module';
export * from './ngmeta.service';
export * from './tag-data.interface';
import { Injectable, Inject } from '@angular/core';
import { DOCUMENT, ɵgetDOM as getDOM } from '@angular/platform-browser';
import { ɵgetDOM as getDOM } from '@angular/platform-browser';
import { DomAdapter } from '@angular/platform-browser/src/dom/dom_adapter';

@@ -15,5 +15,5 @@ import { Router, NavigationEnd } from '@angular/router';

export class NGMeta {
private _document: any;
private _dom: DomAdapter = getDOM();
private _scrollEnabled: boolean = true;
/**

@@ -23,4 +23,4 @@ * Initializes service. Creates faux DOM component to abstractly interact with DOM. Subscribes to route events.

*/
constructor(@Inject(DOCUMENT) private _document: any, private _router: Router) {
constructor(private _router: Router) {
this._document = document as Document;
this._router.events.subscribe((evt: any) => {

@@ -55,3 +55,3 @@ this._scrollToTop(evt);

return this._dom.getTitle(this._document);
} catch (e) { }
} catch (e) { return ''; }
}

@@ -58,0 +58,0 @@

@@ -6,17 +6,28 @@ {

"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"noImplicitAny": true,
"module": "commonjs",
"module": "es2015",
"moduleResolution": "node",
"outDir": "./dist",
"removeComments": true,
"rootDir": "./src",
"paths": {
"@angular/core": ["node_modules/@angular/core"],
"rxjs/*": ["node_modules/rxjs/*"]
},
"rootDir": "src",
"outDir": "dist",
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"sourceMap": false,
"lib": ["dom", "es6"]
"skipLibCheck": true,
"lib": [
"es2015",
"dom"
]
},
"files": [
"./src/index.ts"
]
}
],
"angularCompilerOptions": {
"strictMetadataEmit": true
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc