From f3f3df36b58a2cf89cdcef7fa993eeee4228dc6e Mon Sep 17 00:00:00 2001 From: Rui Silva Date: Fri, 5 Feb 2016 15:37:34 +0000 Subject: [PATCH] Update UMD wrapper to include `angular-cookies` --- gulpfile.js | 22 ++++++++++++++++++---- src/angular-oauth2.js | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1559f62..d6b5057 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,10 +27,24 @@ var config = { umd: { namespace: 'angularOAuth2', exports: 'ngModule', - deps: [ - 'angular', - { name: 'query-string', globalName: 'queryString', paramName: 'queryString' } - ] + template: ` + (function(root, factory) { + if (typeof define === 'function' && define.amd) { + define([ "angular", "angular-cookies", "query-string" ], factory); + } else if (typeof exports === 'object') { + module.exports = factory(require("angular"), require("angular-cookies"), require("query-string")); + } else { + root.<%= namespace %> = factory(root.angular, 'ngCookies', root.queryString); + } + }(this, function(angular, ngCookies, queryString) { + <% if (exports) { %> + <%= contents %> + return <%= exports %>; + <% } else { %> + return <%= contents %>; + <% } %> + })); + ` }, banner: ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', diff --git a/src/angular-oauth2.js b/src/angular-oauth2.js index befc76f..c2e8b16 100644 --- a/src/angular-oauth2.js +++ b/src/angular-oauth2.js @@ -8,10 +8,10 @@ import OAuthProvider from './providers/oauth-provider'; import OAuthTokenProvider from './providers/oauth-token-provider'; import oauthConfig from './config/oauth-config'; import oauthInterceptor from './interceptors/oauth-interceptor'; -import 'angular-cookies'; +import ngCookies from 'angular-cookies'; var ngModule = angular.module('angular-oauth2', [ - 'ngCookies' + ngCookies ]) .config(oauthConfig) .factory('oauthInterceptor', oauthInterceptor)