Skip to content

Commit

Permalink
Using a dynamic import on node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Mulligan committed Nov 6, 2023
1 parent 7fba64c commit b19e8b2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/adobe-ims-servicetoken.cjs
Expand Up @@ -8,7 +8,6 @@
'use strict';

var node_crypto = require('node:crypto');
var fetch = require('node-fetch');

const AMPERSAND = "&";
const BASE64 = "base64";
Expand All @@ -27,6 +26,7 @@ const SHA1 = "sha1";
const STRING = "string";

const tokens = new Map();
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // eslint-disable-line no-shadow

async function token ({
url = DEFAULT_URL,
Expand Down
3 changes: 2 additions & 1 deletion dist/adobe-ims-servicetoken.js
Expand Up @@ -5,7 +5,7 @@
* @license BSD-3-Clause
* @version 3.0.8
*/
import {createHash}from'node:crypto';import fetch from'node-fetch';const AMPERSAND = "&";
import {createHash}from'node:crypto';const AMPERSAND = "&";
const BASE64 = "base64";
const CLIENT_ID = "client_id";
const CLIENT_SECRET = "client_secret";
Expand All @@ -20,6 +20,7 @@ const JWT_TOKEN = "jwt_token";
const POST = "POST";
const SHA1 = "sha1";
const STRING = "string";const tokens = new Map();
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // eslint-disable-line no-shadow

async function token ({
url = DEFAULT_URL,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "adobe-ims-servicetoken",
"version": "3.0.8",
"version": "3.0.9",
"description": "Adobe IMS Service Token lifecycle management",
"source": "src/ims.js",
"main": "dist/adobe-ims-servicetoken.cjs",
Expand Down
2 changes: 1 addition & 1 deletion src/token.js
@@ -1,5 +1,4 @@
import {createHash} from "node:crypto";
import fetch from "node-fetch";
import {
AMPERSAND,
BASE64,
Expand All @@ -19,6 +18,7 @@ import {
} from "./constants.js";

const tokens = new Map();
const fetch = (...args) => import("node-fetch").then(({default: fetch}) => fetch(...args)); // eslint-disable-line no-shadow

export async function token ({
url = DEFAULT_URL,
Expand Down

0 comments on commit b19e8b2

Please sign in to comment.