Skip to content

Commit

Permalink
Update build-library.js and Ray.tsRemoved axios from external depende…
Browse files Browse the repository at this point in the history
…ncies on build-library.js and added import statement for Client on Ray.ts
  • Loading branch information
patinthehat committed May 12, 2023
1 parent 618a5e9 commit db62c8b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion scripts/build-library.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Builder {
...buildConfig.constants,
},
entryPoints: [buildConfig.entry],
external: ['axios'],
external: [],
format: buildConfig.format,
keepNames: true,
logLevel: 'silent',
Expand Down
28 changes: 15 additions & 13 deletions src/Ray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// @ts-ignore
const BUILDING_STANDALONE_LIB = typeof __BUILDING_STANDALONE_LIB__ !== 'undefined' && __BUILDING_STANDALONE_LIB__ === 'true';
1;

//import * as md5lib from 'md5';
import { RayScreenColors } from '@/Concerns/RayScreenColors';
Expand Down Expand Up @@ -57,20 +58,21 @@ import { Limiters } from './Support/Limiters';
import { RateLimiter } from './Support/RateLimiter';
import { nonCryptoUuidV4, sleep } from './lib/utils';
import PACKAGE_VERSION from './lib/version';
import { Client } from './Client';

const md5 = require('md5');

const getSync = StackTrace.getSync;

export type BoolFunction = () => boolean;

let Client: any;
async function initialize() {
Client = await import(BUILDING_STANDALONE_LIB ? './ClientStandalone' : './Client');
// .then((module) => Client = module.default);
}
// let Client: any;
// async function initialize() {
// Client = await import(BUILDING_STANDALONE_LIB ? './ClientStandalone' : './Client');
// // .then((module) => Client = module.default);
// }

initialize();
// initialize();

export class Ray extends Mixin(RayColors, RaySizes, RayScreenColors) {
protected static lockCounter = 0;
Expand Down Expand Up @@ -111,7 +113,7 @@ export class Ray extends Mixin(RayColors, RaySizes, RayScreenColors) {

public static _rateLimiter: RateLimiter = RateLimiter.disabled();

public static create(client: typeof Client | null = null, uuid: string | null = null): Ray {
public static create(client: Client | null = null, uuid: string | null = null): Ray {
if (Ray.defaultSettings.not_defined === true) {
Ray.defaultSettings = {
enable: true,
Expand All @@ -134,7 +136,7 @@ export class Ray extends Mixin(RayColors, RaySizes, RayScreenColors) {
return new this(settings, client, uuid);
}

public constructor(settings: Settings, client: typeof Client | null = null, uuid: string | null = null, inCallback = false) {
public constructor(settings: Settings, client: Client | null = null, uuid: string | null = null, inCallback = false) {
super();

if (Ray.defaultSettings.not_defined === true) {
Expand Down Expand Up @@ -211,7 +213,7 @@ export class Ray extends Mixin(RayColors, RaySizes, RayScreenColors) {
return Ray.interceptor;
}

public client(): typeof Client {
public client(): Client {
return Ray.client;
}

Expand Down Expand Up @@ -240,7 +242,7 @@ export class Ray extends Mixin(RayColors, RaySizes, RayScreenColors) {
return !this.enabled();
}

public static useClient(client: typeof Client): void {
public static useClient(client: Client): void {
this.client = client;
}

Expand Down Expand Up @@ -868,6 +870,6 @@ function standaloneInitialization() {
}
}

if (BUILDING_STANDALONE_LIB) {
standaloneInitialization();
}
//if (BUILDING_STANDALONE_LIB) {
standaloneInitialization();
//}

0 comments on commit db62c8b

Please sign in to comment.