@superfan-app/spotify-auth 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfan-app/spotify-auth",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Spotify OAuth module for Expo",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://github.com/Superfan-App/spotify-auth"
33
+ "url": "git+https://github.com/Superfan-App/spotify-auth.git"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -41,13 +41,11 @@
41
41
  "author": "Superfan <support@superfan.app>",
42
42
  "license": "MIT",
43
43
  "homepage": "https://github.com/Superfan-App/spotify-auth#readme",
44
- "dependencies": {
45
- "@expo/config-plugins": "^9.0.11"
46
- },
47
44
  "devDependencies": {
48
- "@types/react": "~18.3.12",
49
- "@types/react-native": "^0.73.0",
50
- "expo-module-scripts": "^4.0.2",
51
- "expo-modules-core": "^2.1.1"
45
+ "expo-module-scripts": "^4.0.2"
46
+ },
47
+ "peerDependencies": {
48
+ "expo": "*",
49
+ "react-native": "*"
52
50
  }
53
- }
51
+ }
@@ -1,4 +1,4 @@
1
- import { ConfigPlugin } from '@expo/config-plugins';
2
- import { ISpotifyConfig } from './types';
3
- declare const withSpotifyRemote: ConfigPlugin<ISpotifyConfig>;
4
- export default withSpotifyRemote;
1
+ import { type ConfigPlugin } from '@expo/config-plugins';
2
+ import { SpotifyConfig } from './types';
3
+ declare const _default: ConfigPlugin<SpotifyConfig>;
4
+ export default _default;
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const config_plugins_1 = require("@expo/config-plugins");
3
7
  const withSpotifyQueryScheme_1 = require("./ios/withSpotifyQueryScheme");
4
8
  const withSpotifyURLScheme_1 = require("./ios/withSpotifyURLScheme");
5
9
  const withSpotifyConfig_1 = require("./withSpotifyConfig");
6
- const withSpotifyRemote = (config, props) => {
7
- config = (0, withSpotifyConfig_1.withSpotifyConfig)(config, props);
10
+ const package_json_1 = __importDefault(require("../../package.json"));
11
+ const withSpotifyAuth = (config, props) => {
12
+ config = (0, withSpotifyConfig_1.withSpotifyOAuthConfig)(config, props);
8
13
  // iOS specific
9
14
  config = (0, withSpotifyQueryScheme_1.withSpotifyQueryScheme)(config, props);
10
15
  config = (0, withSpotifyURLScheme_1.withSpotifyURLScheme)(config, props);
11
16
  return config;
12
17
  };
13
- exports.default = withSpotifyRemote;
18
+ exports.default = (0, config_plugins_1.createRunOncePlugin)(withSpotifyAuth, package_json_1.default.name, package_json_1.default.version);
@@ -1,3 +1,3 @@
1
1
  import { ConfigPlugin } from "expo/config-plugins";
2
- import { ISpotifyConfig } from "../types";
3
- export declare const withSpotifyQueryScheme: ConfigPlugin<ISpotifyConfig>;
2
+ import { SpotifyConfig } from "../types";
3
+ export declare const withSpotifyQueryScheme: ConfigPlugin<SpotifyConfig>;
@@ -1,3 +1,3 @@
1
- import { ConfigPlugin } from "expo/config-plugins";
2
- import { ISpotifyConfig } from "../types";
3
- export declare const withSpotifyURLScheme: ConfigPlugin<ISpotifyConfig>;
1
+ import { type ConfigPlugin } from "expo/config-plugins";
2
+ import { SpotifyConfig } from "../types";
3
+ export declare const withSpotifyURLScheme: ConfigPlugin<SpotifyConfig>;
@@ -1,5 +1,5 @@
1
1
  export type SpotifyScopes = 'app-remote-control' | 'playlist-modify-private' | 'playlist-modify-public' | 'playlist-read-collaborative' | 'playlist-read-private' | 'streaming' | 'user-follow-modify' | 'user-follow-read' | 'user-library-modify' | 'user-library-read' | 'user-modify-playback-state' | 'user-read-currently-playing' | 'user-read-email' | 'user-read-playback-position' | 'user-read-playback-state' | 'user-read-private' | 'user-read-recently-played' | 'user-top-read';
2
- export interface ISpotifyConfig {
2
+ export interface SpotifyConfig {
3
3
  clientID: string;
4
4
  tokenRefreshURL: string;
5
5
  tokenSwapURL: string;
@@ -1,3 +1,3 @@
1
- import { ConfigPlugin } from 'expo/config-plugins';
2
- import { ISpotifyConfig } from './types';
3
- export declare const withSpotifyConfig: ConfigPlugin<ISpotifyConfig>;
1
+ import { type ConfigPlugin } from 'expo/config-plugins';
2
+ import { SpotifyConfig } from './types';
3
+ export declare const withSpotifyOAuthConfig: ConfigPlugin<SpotifyConfig>;
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withSpotifyConfig = void 0;
3
+ exports.withSpotifyOAuthConfig = void 0;
4
4
  const config_plugins_1 = require("expo/config-plugins");
5
- const withSpotifyConfigIOS = (config, spotifyConfig) => {
5
+ const withSpotifyOAuthConfigIOS = (config, spotifyConfig) => {
6
6
  return (0, config_plugins_1.withInfoPlist)(config, (config) => {
7
- Object.entries(spotifyConfig).forEach(([key, value]) => {
8
- config.modResults[key] = value;
9
- });
7
+ config.modResults.SpotifyClientID = spotifyConfig.clientID;
8
+ config.modResults.SpotifyScheme = spotifyConfig.scheme;
9
+ config.modResults.SpotifyCallback = spotifyConfig.callback;
10
+ config.modResults.SpotifyScopes = spotifyConfig.scopes;
11
+ config.modResults.tokenRefreshURL = spotifyConfig.tokenRefreshURL;
12
+ config.modResults.tokenSwapURL = spotifyConfig.tokenSwapURL;
10
13
  return config;
11
14
  });
12
15
  };
13
- const withSpotifyConfig = (config, spotifyConfig) => {
14
- config = withSpotifyConfigIOS(config, spotifyConfig);
16
+ const withSpotifyOAuthConfig = (config, spotifyConfig) => {
17
+ config = withSpotifyOAuthConfigIOS(config, spotifyConfig);
15
18
  return config;
16
19
  };
17
- exports.withSpotifyConfig = withSpotifyConfig;
20
+ exports.withSpotifyOAuthConfig = withSpotifyOAuthConfig;
@@ -1,12 +1,14 @@
1
- import { ConfigPlugin } from '@expo/config-plugins'
1
+ import { type ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins'
2
2
 
3
3
  import { withSpotifyQueryScheme } from './ios/withSpotifyQueryScheme'
4
4
  import { withSpotifyURLScheme } from './ios/withSpotifyURLScheme'
5
- import { ISpotifyConfig } from './types'
6
- import { withSpotifyConfig } from './withSpotifyConfig'
5
+ import { SpotifyConfig } from './types'
6
+ import { withSpotifyOAuthConfig } from './withSpotifyConfig'
7
7
 
8
- const withSpotifyRemote: ConfigPlugin<ISpotifyConfig> = (config, props) => {
9
- config = withSpotifyConfig(config, props)
8
+ import pkg from '../../package.json'
9
+
10
+ const withSpotifyAuth: ConfigPlugin<SpotifyConfig> = (config, props) => {
11
+ config = withSpotifyOAuthConfig(config, props)
10
12
 
11
13
  // iOS specific
12
14
  config = withSpotifyQueryScheme(config, props)
@@ -15,4 +17,4 @@ const withSpotifyRemote: ConfigPlugin<ISpotifyConfig> = (config, props) => {
15
17
  return config
16
18
  }
17
19
 
18
- export default withSpotifyRemote
20
+ export default createRunOncePlugin(withSpotifyAuth, pkg.name, pkg.version);
@@ -1,10 +1,10 @@
1
1
  import { ConfigPlugin, withInfoPlist } from "expo/config-plugins";
2
2
 
3
- import { ISpotifyConfig } from "../types";
3
+ import { SpotifyConfig } from "../types";
4
4
 
5
5
  const spotifyScheme = "spotify";
6
6
 
7
- export const withSpotifyQueryScheme: ConfigPlugin<ISpotifyConfig> = (config) =>
7
+ export const withSpotifyQueryScheme: ConfigPlugin<SpotifyConfig> = (config) =>
8
8
  withInfoPlist(config, (config) => {
9
9
  if (!config.modResults.LSApplicationQueriesSchemes) {
10
10
  config.modResults.LSApplicationQueriesSchemes = [];
@@ -1,8 +1,8 @@
1
- import { ConfigPlugin, withInfoPlist } from "expo/config-plugins";
1
+ import { type ConfigPlugin, withInfoPlist } from "expo/config-plugins";
2
2
 
3
- import { ISpotifyConfig } from "../types";
3
+ import { SpotifyConfig } from "../types";
4
4
 
5
- export const withSpotifyURLScheme: ConfigPlugin<ISpotifyConfig> = (
5
+ export const withSpotifyURLScheme: ConfigPlugin<SpotifyConfig> = (
6
6
  config,
7
7
  { scheme }
8
8
  ) => {
@@ -18,7 +18,7 @@ export type SpotifyScopes =
18
18
  | 'user-read-recently-played'
19
19
  | 'user-top-read'
20
20
 
21
- export interface ISpotifyConfig {
21
+ export interface SpotifyConfig {
22
22
  clientID: string
23
23
  tokenRefreshURL: string
24
24
  tokenSwapURL: string
@@ -1,19 +1,20 @@
1
- import { ConfigPlugin, withInfoPlist } from 'expo/config-plugins'
1
+ import { type ConfigPlugin, withInfoPlist } from 'expo/config-plugins'
2
2
 
3
- import { ISpotifyConfig } from './types'
3
+ import { SpotifyConfig } from './types'
4
4
 
5
- const withSpotifyConfigIOS: ConfigPlugin<ISpotifyConfig> = (config, spotifyConfig) => {
5
+ const withSpotifyOAuthConfigIOS: ConfigPlugin<SpotifyConfig> = (config, spotifyConfig) => {
6
6
  return withInfoPlist(config, (config) => {
7
- Object.entries(spotifyConfig).forEach(([key, value]) => {
8
- config.modResults[key] = value
9
- })
10
-
11
- return config
12
- })
13
- }
14
-
15
- export const withSpotifyConfig: ConfigPlugin<ISpotifyConfig> = (config, spotifyConfig) => {
16
- config = withSpotifyConfigIOS(config, spotifyConfig)
7
+ config.modResults.SpotifyClientID = spotifyConfig.clientID;
8
+ config.modResults.SpotifyScheme = spotifyConfig.scheme;
9
+ config.modResults.SpotifyCallback = spotifyConfig.callback;
10
+ config.modResults.SpotifyScopes = spotifyConfig.scopes;
11
+ config.modResults.tokenRefreshURL = spotifyConfig.tokenRefreshURL;
12
+ config.modResults.tokenSwapURL = spotifyConfig.tokenSwapURL;
13
+ return config;
14
+ });
15
+ };
17
16
 
17
+ export const withSpotifyOAuthConfig: ConfigPlugin<SpotifyConfig> = (config, spotifyConfig) => {
18
+ config = withSpotifyOAuthConfigIOS(config, spotifyConfig)
18
19
  return config
19
20
  }
@@ -2,7 +2,8 @@
2
2
  "extends": "expo-module-scripts/tsconfig.plugin",
3
3
  "compilerOptions": {
4
4
  "outDir": "build",
5
- "rootDir": "src"
5
+ "rootDir": "src",
6
+ "resolveJsonModule": true
6
7
  },
7
8
  "include": ["./src"],
8
9
  "exclude": ["**/__mocks__/*", "**/__tests__/*"]