UNPKG

@azure/static-web-apps-cli

Version:
37 lines 1.33 kB
import { logger } from "../utils/logger.js"; import { SWACLIPersistenceCachePlugin } from "./persistence-cache-plugin.js"; async function createSWAPersistenceCachePlugin(options) { return new SWACLIPersistenceCachePlugin(options); } /** * A plugin that provides persistent token caching for `@azure/identity` * credentials. The plugin API is compatible with `@azure/identity` versions * 2.0.0 and later. Load this plugin using the `useIdentityPlugin` * function, imported from `@azure/identity`. * * In order to enable this functionality, you must also pass * `tokenCachePersistenceOptions` to your credential constructors with an * `enabled` property set to true. * * Example: * * ```javascript * import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity"; * import { swaCliPersistencePlugin } from "@azure/static-web-apps-cli"; * * // Load the plugin * useIdentityPlugin(swaCliPersistencePlugin); * * const credential = new DeviceCodeCredential({ * tokenCachePersistenceOptions: { * enabled: true * } * }); * ``` */ export const swaCliPersistencePlugin = (context) => { logger.silly("Executing swaCliPersistencePlugin"); const { cachePluginControl } = context; cachePluginControl.setPersistence(createSWAPersistenceCachePlugin); }; //# sourceMappingURL=index.js.map