eshala dorost she
This commit is contained in:
Generated
Vendored
Generated
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@vue/devtools-api",
|
||||
"type": "module",
|
||||
"version": "7.7.6",
|
||||
"version": "7.7.7",
|
||||
"author": "webfansplz",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@vue/devtools-kit": "^7.7.6"
|
||||
"@vue/devtools-kit": "^7.7.7"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup --clean",
|
||||
+295
-167
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.27.2",
|
||||
"version": "7.28.0",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
||||
@@ -35,12 +35,12 @@
|
||||
},
|
||||
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.27.1"
|
||||
"@babel/types": "^7.28.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/helper-check-duplicate-nodes": "^7.27.1",
|
||||
"@babel/helper-fixtures": "^7.27.1",
|
||||
"@babel/helper-fixtures": "^7.28.0",
|
||||
"@babel/helper-string-parser": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.27.1",
|
||||
"charcodes": "^0.2.0"
|
||||
|
||||
+52
-7
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/runtime",
|
||||
"version": "7.27.1",
|
||||
"version": "7.28.2",
|
||||
"description": "babel's modular runtime helpers",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
@@ -581,15 +581,51 @@
|
||||
"./helpers/readOnlyError.js"
|
||||
],
|
||||
"./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js",
|
||||
"./helpers/regeneratorRuntime": [
|
||||
"./helpers/regenerator": [
|
||||
{
|
||||
"node": "./helpers/regeneratorRuntime.js",
|
||||
"import": "./helpers/esm/regeneratorRuntime.js",
|
||||
"default": "./helpers/regeneratorRuntime.js"
|
||||
"node": "./helpers/regenerator.js",
|
||||
"import": "./helpers/esm/regenerator.js",
|
||||
"default": "./helpers/regenerator.js"
|
||||
},
|
||||
"./helpers/regeneratorRuntime.js"
|
||||
"./helpers/regenerator.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js",
|
||||
"./helpers/esm/regenerator": "./helpers/esm/regenerator.js",
|
||||
"./helpers/regeneratorAsync": [
|
||||
{
|
||||
"node": "./helpers/regeneratorAsync.js",
|
||||
"import": "./helpers/esm/regeneratorAsync.js",
|
||||
"default": "./helpers/regeneratorAsync.js"
|
||||
},
|
||||
"./helpers/regeneratorAsync.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorAsync": "./helpers/esm/regeneratorAsync.js",
|
||||
"./helpers/regeneratorAsyncGen": [
|
||||
{
|
||||
"node": "./helpers/regeneratorAsyncGen.js",
|
||||
"import": "./helpers/esm/regeneratorAsyncGen.js",
|
||||
"default": "./helpers/regeneratorAsyncGen.js"
|
||||
},
|
||||
"./helpers/regeneratorAsyncGen.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorAsyncGen": "./helpers/esm/regeneratorAsyncGen.js",
|
||||
"./helpers/regeneratorKeys": [
|
||||
{
|
||||
"node": "./helpers/regeneratorKeys.js",
|
||||
"import": "./helpers/esm/regeneratorKeys.js",
|
||||
"default": "./helpers/regeneratorKeys.js"
|
||||
},
|
||||
"./helpers/regeneratorKeys.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorKeys": "./helpers/esm/regeneratorKeys.js",
|
||||
"./helpers/regeneratorValues": [
|
||||
{
|
||||
"node": "./helpers/regeneratorValues.js",
|
||||
"import": "./helpers/esm/regeneratorValues.js",
|
||||
"default": "./helpers/regeneratorValues.js"
|
||||
},
|
||||
"./helpers/regeneratorValues.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorValues": "./helpers/esm/regeneratorValues.js",
|
||||
"./helpers/set": [
|
||||
{
|
||||
"node": "./helpers/set.js",
|
||||
@@ -1040,6 +1076,15 @@
|
||||
"./helpers/objectSpread.js"
|
||||
],
|
||||
"./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js",
|
||||
"./helpers/regeneratorRuntime": [
|
||||
{
|
||||
"node": "./helpers/regeneratorRuntime.js",
|
||||
"import": "./helpers/esm/regeneratorRuntime.js",
|
||||
"default": "./helpers/regeneratorRuntime.js"
|
||||
},
|
||||
"./helpers/regeneratorRuntime.js"
|
||||
],
|
||||
"./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js",
|
||||
"./helpers/using": [
|
||||
{
|
||||
"node": "./helpers/using.js",
|
||||
|
||||
+11
-1
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fetch_1 = require("./lib/fetch");
|
||||
const helpers_1 = require("./lib/helpers");
|
||||
const types_1 = require("./lib/types");
|
||||
const errors_1 = require("./lib/errors");
|
||||
class GoTrueAdminApi {
|
||||
constructor({ url = '', headers = {}, fetch, }) {
|
||||
@@ -29,7 +30,10 @@ class GoTrueAdminApi {
|
||||
* @param jwt A valid, logged-in JWT.
|
||||
* @param scope The logout sope.
|
||||
*/
|
||||
async signOut(jwt, scope = 'global') {
|
||||
async signOut(jwt, scope = types_1.SIGN_OUT_SCOPES[0]) {
|
||||
if (types_1.SIGN_OUT_SCOPES.indexOf(scope) < 0) {
|
||||
throw new Error(`@supabase/auth-js: Parameter scope must be one of ${types_1.SIGN_OUT_SCOPES.join(', ')}`);
|
||||
}
|
||||
try {
|
||||
await (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/logout?scope=${scope}`, {
|
||||
headers: this.headers,
|
||||
@@ -171,6 +175,7 @@ class GoTrueAdminApi {
|
||||
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
||||
*/
|
||||
async getUserById(uid) {
|
||||
(0, helpers_1.validateUUID)(uid);
|
||||
try {
|
||||
return await (0, fetch_1._request)(this.fetch, 'GET', `${this.url}/admin/users/${uid}`, {
|
||||
headers: this.headers,
|
||||
@@ -192,6 +197,7 @@ class GoTrueAdminApi {
|
||||
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
||||
*/
|
||||
async updateUserById(uid, attributes) {
|
||||
(0, helpers_1.validateUUID)(uid);
|
||||
try {
|
||||
return await (0, fetch_1._request)(this.fetch, 'PUT', `${this.url}/admin/users/${uid}`, {
|
||||
body: attributes,
|
||||
@@ -216,6 +222,7 @@ class GoTrueAdminApi {
|
||||
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
||||
*/
|
||||
async deleteUser(id, shouldSoftDelete = false) {
|
||||
(0, helpers_1.validateUUID)(id);
|
||||
try {
|
||||
return await (0, fetch_1._request)(this.fetch, 'DELETE', `${this.url}/admin/users/${id}`, {
|
||||
headers: this.headers,
|
||||
@@ -233,6 +240,7 @@ class GoTrueAdminApi {
|
||||
}
|
||||
}
|
||||
async _listFactors(params) {
|
||||
(0, helpers_1.validateUUID)(params.userId);
|
||||
try {
|
||||
const { data, error } = await (0, fetch_1._request)(this.fetch, 'GET', `${this.url}/admin/users/${params.userId}/factors`, {
|
||||
headers: this.headers,
|
||||
@@ -250,6 +258,8 @@ class GoTrueAdminApi {
|
||||
}
|
||||
}
|
||||
async _deleteFactor(params) {
|
||||
(0, helpers_1.validateUUID)(params.userId);
|
||||
(0, helpers_1.validateUUID)(params.id);
|
||||
try {
|
||||
const data = await (0, fetch_1._request)(this.fetch, 'DELETE', `${this.url}/admin/users/${params.userId}/factors/${params.id}`, {
|
||||
headers: this.headers,
|
||||
|
||||
+316
-21
@@ -13,6 +13,7 @@ const polyfills_1 = require("./lib/polyfills");
|
||||
const version_1 = require("./lib/version");
|
||||
const locks_1 = require("./lib/locks");
|
||||
const base64url_1 = require("./lib/base64url");
|
||||
const helpers_2 = require("./lib/helpers");
|
||||
(0, polyfills_1.polyfillGlobalThis)(); // Make "globalThis" available
|
||||
const DEFAULT_OPTIONS = {
|
||||
url: constants_1.GOTRUE_URL,
|
||||
@@ -28,12 +29,25 @@ const DEFAULT_OPTIONS = {
|
||||
async function lockNoOp(name, acquireTimeout, fn) {
|
||||
return await fn();
|
||||
}
|
||||
/**
|
||||
* Caches JWKS values for all clients created in the same environment. This is
|
||||
* especially useful for shared-memory execution environments such as Vercel's
|
||||
* Fluid Compute, AWS Lambda or Supabase's Edge Functions. Regardless of how
|
||||
* many clients are created, if they share the same storage key they will use
|
||||
* the same JWKS cache, significantly speeding up getClaims() with asymmetric
|
||||
* JWTs.
|
||||
*/
|
||||
const GLOBAL_JWKS = {};
|
||||
class GoTrueClient {
|
||||
/**
|
||||
* Create a new client for use in the browser.
|
||||
*/
|
||||
constructor(options) {
|
||||
var _a, _b;
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
this.userStorage = null;
|
||||
this.memoryStorage = null;
|
||||
this.stateChangeEmitters = new Map();
|
||||
this.autoRefreshTicker = null;
|
||||
@@ -90,8 +104,10 @@ class GoTrueClient {
|
||||
else {
|
||||
this.lock = lockNoOp;
|
||||
}
|
||||
this.jwks = { keys: [] };
|
||||
this.jwks_cached_at = Number.MIN_SAFE_INTEGER;
|
||||
if (!this.jwks) {
|
||||
this.jwks = { keys: [] };
|
||||
this.jwks_cached_at = Number.MIN_SAFE_INTEGER;
|
||||
}
|
||||
this.mfa = {
|
||||
verify: this._verify.bind(this),
|
||||
enroll: this._enroll.bind(this),
|
||||
@@ -107,13 +123,16 @@ class GoTrueClient {
|
||||
}
|
||||
else {
|
||||
if ((0, helpers_1.supportsLocalStorage)()) {
|
||||
this.storage = local_storage_1.localStorageAdapter;
|
||||
this.storage = globalThis.localStorage;
|
||||
}
|
||||
else {
|
||||
this.memoryStorage = {};
|
||||
this.storage = (0, local_storage_1.memoryLocalStorageAdapter)(this.memoryStorage);
|
||||
}
|
||||
}
|
||||
if (settings.userStorage) {
|
||||
this.userStorage = settings.userStorage;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.memoryStorage = {};
|
||||
@@ -133,6 +152,23 @@ class GoTrueClient {
|
||||
}
|
||||
this.initialize();
|
||||
}
|
||||
/**
|
||||
* The JWKS used for verifying asymmetric JWTs
|
||||
*/
|
||||
get jwks() {
|
||||
var _a, _b;
|
||||
return (_b = (_a = GLOBAL_JWKS[this.storageKey]) === null || _a === void 0 ? void 0 : _a.jwks) !== null && _b !== void 0 ? _b : { keys: [] };
|
||||
}
|
||||
set jwks(value) {
|
||||
GLOBAL_JWKS[this.storageKey] = Object.assign(Object.assign({}, GLOBAL_JWKS[this.storageKey]), { jwks: value });
|
||||
}
|
||||
get jwks_cached_at() {
|
||||
var _a, _b;
|
||||
return (_b = (_a = GLOBAL_JWKS[this.storageKey]) === null || _a === void 0 ? void 0 : _a.cachedAt) !== null && _b !== void 0 ? _b : Number.MIN_SAFE_INTEGER;
|
||||
}
|
||||
set jwks_cached_at(value) {
|
||||
GLOBAL_JWKS[this.storageKey] = Object.assign(Object.assign({}, GLOBAL_JWKS[this.storageKey]), { cachedAt: value });
|
||||
}
|
||||
_debug(...args) {
|
||||
if (this.logDebugMessages) {
|
||||
this.logger(`GoTrueClient@${this.instanceID} (${version_1.version}) ${new Date().toISOString()}`, ...args);
|
||||
@@ -415,6 +451,157 @@ class GoTrueClient {
|
||||
return this._exchangeCodeForSession(authCode);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Signs in a user by verifying a message signed by the user's private key.
|
||||
* Only Solana supported at this time, using the Sign in with Solana standard.
|
||||
*/
|
||||
async signInWithWeb3(credentials) {
|
||||
const { chain } = credentials;
|
||||
if (chain === 'solana') {
|
||||
return await this.signInWithSolana(credentials);
|
||||
}
|
||||
throw new Error(`@supabase/auth-js: Unsupported chain "${chain}"`);
|
||||
}
|
||||
async signInWithSolana(credentials) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
||||
let message;
|
||||
let signature;
|
||||
if ('message' in credentials) {
|
||||
message = credentials.message;
|
||||
signature = credentials.signature;
|
||||
}
|
||||
else {
|
||||
const { chain, wallet, statement, options } = credentials;
|
||||
let resolvedWallet;
|
||||
if (!(0, helpers_1.isBrowser)()) {
|
||||
if (typeof wallet !== 'object' || !(options === null || options === void 0 ? void 0 : options.url)) {
|
||||
throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');
|
||||
}
|
||||
resolvedWallet = wallet;
|
||||
}
|
||||
else if (typeof wallet === 'object') {
|
||||
resolvedWallet = wallet;
|
||||
}
|
||||
else {
|
||||
const windowAny = window;
|
||||
if ('solana' in windowAny &&
|
||||
typeof windowAny.solana === 'object' &&
|
||||
(('signIn' in windowAny.solana && typeof windowAny.solana.signIn === 'function') ||
|
||||
('signMessage' in windowAny.solana &&
|
||||
typeof windowAny.solana.signMessage === 'function'))) {
|
||||
resolvedWallet = windowAny.solana;
|
||||
}
|
||||
else {
|
||||
throw new Error(`@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.`);
|
||||
}
|
||||
}
|
||||
const url = new URL((_a = options === null || options === void 0 ? void 0 : options.url) !== null && _a !== void 0 ? _a : window.location.href);
|
||||
if ('signIn' in resolvedWallet && resolvedWallet.signIn) {
|
||||
const output = await resolvedWallet.signIn(Object.assign(Object.assign(Object.assign({ issuedAt: new Date().toISOString() }, options === null || options === void 0 ? void 0 : options.signInWithSolana), {
|
||||
// non-overridable properties
|
||||
version: '1', domain: url.host, uri: url.href }), (statement ? { statement } : null)));
|
||||
let outputToProcess;
|
||||
if (Array.isArray(output) && output[0] && typeof output[0] === 'object') {
|
||||
outputToProcess = output[0];
|
||||
}
|
||||
else if (output &&
|
||||
typeof output === 'object' &&
|
||||
'signedMessage' in output &&
|
||||
'signature' in output) {
|
||||
outputToProcess = output;
|
||||
}
|
||||
else {
|
||||
throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');
|
||||
}
|
||||
if ('signedMessage' in outputToProcess &&
|
||||
'signature' in outputToProcess &&
|
||||
(typeof outputToProcess.signedMessage === 'string' ||
|
||||
outputToProcess.signedMessage instanceof Uint8Array) &&
|
||||
outputToProcess.signature instanceof Uint8Array) {
|
||||
message =
|
||||
typeof outputToProcess.signedMessage === 'string'
|
||||
? outputToProcess.signedMessage
|
||||
: new TextDecoder().decode(outputToProcess.signedMessage);
|
||||
signature = outputToProcess.signature;
|
||||
}
|
||||
else {
|
||||
throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!('signMessage' in resolvedWallet) ||
|
||||
typeof resolvedWallet.signMessage !== 'function' ||
|
||||
!('publicKey' in resolvedWallet) ||
|
||||
typeof resolvedWallet !== 'object' ||
|
||||
!resolvedWallet.publicKey ||
|
||||
!('toBase58' in resolvedWallet.publicKey) ||
|
||||
typeof resolvedWallet.publicKey.toBase58 !== 'function') {
|
||||
throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');
|
||||
}
|
||||
message = [
|
||||
`${url.host} wants you to sign in with your Solana account:`,
|
||||
resolvedWallet.publicKey.toBase58(),
|
||||
...(statement ? ['', statement, ''] : ['']),
|
||||
'Version: 1',
|
||||
`URI: ${url.href}`,
|
||||
`Issued At: ${(_c = (_b = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _b === void 0 ? void 0 : _b.issuedAt) !== null && _c !== void 0 ? _c : new Date().toISOString()}`,
|
||||
...(((_d = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _d === void 0 ? void 0 : _d.notBefore)
|
||||
? [`Not Before: ${options.signInWithSolana.notBefore}`]
|
||||
: []),
|
||||
...(((_e = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _e === void 0 ? void 0 : _e.expirationTime)
|
||||
? [`Expiration Time: ${options.signInWithSolana.expirationTime}`]
|
||||
: []),
|
||||
...(((_f = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _f === void 0 ? void 0 : _f.chainId)
|
||||
? [`Chain ID: ${options.signInWithSolana.chainId}`]
|
||||
: []),
|
||||
...(((_g = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _g === void 0 ? void 0 : _g.nonce) ? [`Nonce: ${options.signInWithSolana.nonce}`] : []),
|
||||
...(((_h = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _h === void 0 ? void 0 : _h.requestId)
|
||||
? [`Request ID: ${options.signInWithSolana.requestId}`]
|
||||
: []),
|
||||
...(((_k = (_j = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _j === void 0 ? void 0 : _j.resources) === null || _k === void 0 ? void 0 : _k.length)
|
||||
? [
|
||||
'Resources',
|
||||
...options.signInWithSolana.resources.map((resource) => `- ${resource}`),
|
||||
]
|
||||
: []),
|
||||
].join('\n');
|
||||
const maybeSignature = await resolvedWallet.signMessage(new TextEncoder().encode(message), 'utf8');
|
||||
if (!maybeSignature || !(maybeSignature instanceof Uint8Array)) {
|
||||
throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');
|
||||
}
|
||||
signature = maybeSignature;
|
||||
}
|
||||
}
|
||||
try {
|
||||
const { data, error } = await (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/token?grant_type=web3`, {
|
||||
headers: this.headers,
|
||||
body: Object.assign({ chain: 'solana', message, signature: (0, base64url_1.bytesToBase64URL)(signature) }, (((_l = credentials.options) === null || _l === void 0 ? void 0 : _l.captchaToken)
|
||||
? { gotrue_meta_security: { captcha_token: (_m = credentials.options) === null || _m === void 0 ? void 0 : _m.captchaToken } }
|
||||
: null)),
|
||||
xform: fetch_1._sessionResponse,
|
||||
});
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
if (!data || !data.session || !data.user) {
|
||||
return {
|
||||
data: { user: null, session: null },
|
||||
error: new errors_1.AuthInvalidTokenResponseError(),
|
||||
};
|
||||
}
|
||||
if (data.session) {
|
||||
await this._saveSession(data.session);
|
||||
await this._notifyAllSubscribers('SIGNED_IN', data.session);
|
||||
}
|
||||
return { data: Object.assign({}, data), error };
|
||||
}
|
||||
catch (error) {
|
||||
if ((0, errors_1.isAuthError)(error)) {
|
||||
return { data: { user: null, session: null }, error };
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
async _exchangeCodeForSession(authCode) {
|
||||
const storageItem = await (0, helpers_1.getItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
||||
const [codeVerifier, redirectType] = (storageItem !== null && storageItem !== void 0 ? storageItem : '').split('/');
|
||||
@@ -834,7 +1021,16 @@ class GoTrueClient {
|
||||
: false;
|
||||
this._debug('#__loadSession()', `session has${hasExpired ? '' : ' not'} expired`, 'expires_at', currentSession.expires_at);
|
||||
if (!hasExpired) {
|
||||
if (this.storage.isServer) {
|
||||
if (this.userStorage) {
|
||||
const maybeUser = (await (0, helpers_1.getItemAsync)(this.userStorage, this.storageKey + '-user'));
|
||||
if (maybeUser === null || maybeUser === void 0 ? void 0 : maybeUser.user) {
|
||||
currentSession.user = maybeUser.user;
|
||||
}
|
||||
else {
|
||||
currentSession.user = (0, helpers_1.userNotAvailableProxy)();
|
||||
}
|
||||
}
|
||||
if (this.storage.isServer && currentSession.user) {
|
||||
let suppressWarning = this.suppressGetSessionWarning;
|
||||
const proxySession = new Proxy(currentSession, {
|
||||
get: (target, prop, receiver) => {
|
||||
@@ -1430,11 +1626,39 @@ class GoTrueClient {
|
||||
* Note: this method is async to accommodate for AsyncStorage e.g. in React native.
|
||||
*/
|
||||
async _recoverAndRefresh() {
|
||||
var _a;
|
||||
var _a, _b;
|
||||
const debugName = '#_recoverAndRefresh()';
|
||||
this._debug(debugName, 'begin');
|
||||
try {
|
||||
const currentSession = await (0, helpers_1.getItemAsync)(this.storage, this.storageKey);
|
||||
const currentSession = (await (0, helpers_1.getItemAsync)(this.storage, this.storageKey));
|
||||
if (currentSession && this.userStorage) {
|
||||
let maybeUser = (await (0, helpers_1.getItemAsync)(this.userStorage, this.storageKey + '-user'));
|
||||
if (!this.storage.isServer && Object.is(this.storage, this.userStorage) && !maybeUser) {
|
||||
// storage and userStorage are the same storage medium, for example
|
||||
// window.localStorage if userStorage does not have the user from
|
||||
// storage stored, store it first thereby migrating the user object
|
||||
// from storage -> userStorage
|
||||
maybeUser = { user: currentSession.user };
|
||||
await (0, helpers_1.setItemAsync)(this.userStorage, this.storageKey + '-user', maybeUser);
|
||||
}
|
||||
currentSession.user = (_a = maybeUser === null || maybeUser === void 0 ? void 0 : maybeUser.user) !== null && _a !== void 0 ? _a : (0, helpers_1.userNotAvailableProxy)();
|
||||
}
|
||||
else if (currentSession && !currentSession.user) {
|
||||
// user storage is not set, let's check if it was previously enabled so
|
||||
// we bring back the storage as it should be
|
||||
if (!currentSession.user) {
|
||||
// test if userStorage was previously enabled and the storage medium was the same, to move the user back under the same key
|
||||
const separateUser = (await (0, helpers_1.getItemAsync)(this.storage, this.storageKey + '-user'));
|
||||
if (separateUser && (separateUser === null || separateUser === void 0 ? void 0 : separateUser.user)) {
|
||||
currentSession.user = separateUser.user;
|
||||
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey + '-user');
|
||||
await (0, helpers_1.setItemAsync)(this.storage, this.storageKey, currentSession);
|
||||
}
|
||||
else {
|
||||
currentSession.user = (0, helpers_1.userNotAvailableProxy)();
|
||||
}
|
||||
}
|
||||
}
|
||||
this._debug(debugName, 'session from storage', currentSession);
|
||||
if (!this._isValidSession(currentSession)) {
|
||||
this._debug(debugName, 'session is not valid');
|
||||
@@ -1443,7 +1667,7 @@ class GoTrueClient {
|
||||
}
|
||||
return;
|
||||
}
|
||||
const expiresWithMargin = ((_a = currentSession.expires_at) !== null && _a !== void 0 ? _a : Infinity) * 1000 - Date.now() < constants_1.EXPIRY_MARGIN_MS;
|
||||
const expiresWithMargin = ((_b = currentSession.expires_at) !== null && _b !== void 0 ? _b : Infinity) * 1000 - Date.now() < constants_1.EXPIRY_MARGIN_MS;
|
||||
this._debug(debugName, `session has${expiresWithMargin ? '' : ' not'} expired with margin of ${constants_1.EXPIRY_MARGIN_MS}s`);
|
||||
if (expiresWithMargin) {
|
||||
if (this.autoRefreshToken && currentSession.refresh_token) {
|
||||
@@ -1457,6 +1681,25 @@ class GoTrueClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currentSession.user &&
|
||||
currentSession.user.__isUserNotAvailableProxy === true) {
|
||||
// If we have a proxy user, try to get the real user data
|
||||
try {
|
||||
const { data, error: userError } = await this._getUser(currentSession.access_token);
|
||||
if (!userError && (data === null || data === void 0 ? void 0 : data.user)) {
|
||||
currentSession.user = data.user;
|
||||
await this._saveSession(currentSession);
|
||||
await this._notifyAllSubscribers('SIGNED_IN', currentSession);
|
||||
}
|
||||
else {
|
||||
this._debug(debugName, 'could not get user data, skipping SIGNED_IN notification');
|
||||
}
|
||||
}
|
||||
catch (getUserError) {
|
||||
console.error('Error getting user data:', getUserError);
|
||||
this._debug(debugName, 'error getting user data, skipping SIGNED_IN notification', getUserError);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no need to persist currentSession again, as we just loaded it from
|
||||
// local storage; persisting it again may overwrite a value saved by
|
||||
@@ -1552,11 +1795,45 @@ class GoTrueClient {
|
||||
// _saveSession is always called whenever a new session has been acquired
|
||||
// so we can safely suppress the warning returned by future getSession calls
|
||||
this.suppressGetSessionWarning = true;
|
||||
await (0, helpers_1.setItemAsync)(this.storage, this.storageKey, session);
|
||||
// Create a shallow copy to work with, to avoid mutating the original session object if it's used elsewhere
|
||||
const sessionToProcess = Object.assign({}, session);
|
||||
const userIsProxy = sessionToProcess.user && sessionToProcess.user.__isUserNotAvailableProxy === true;
|
||||
if (this.userStorage) {
|
||||
if (!userIsProxy && sessionToProcess.user) {
|
||||
// If it's a real user object, save it to userStorage.
|
||||
await (0, helpers_1.setItemAsync)(this.userStorage, this.storageKey + '-user', {
|
||||
user: sessionToProcess.user,
|
||||
});
|
||||
}
|
||||
else if (userIsProxy) {
|
||||
// If it's the proxy, it means user was not found in userStorage.
|
||||
// We should ensure no stale user data for this key exists in userStorage if we were to save null,
|
||||
// or simply not save the proxy. For now, we don't save the proxy here.
|
||||
// If there's a need to clear userStorage if user becomes proxy, that logic would go here.
|
||||
}
|
||||
// Prepare the main session data for primary storage: remove the user property before cloning
|
||||
// This is important because the original session.user might be the proxy
|
||||
const mainSessionData = Object.assign({}, sessionToProcess);
|
||||
delete mainSessionData.user; // Remove user (real or proxy) before cloning for main storage
|
||||
const clonedMainSessionData = (0, helpers_2.deepClone)(mainSessionData);
|
||||
await (0, helpers_1.setItemAsync)(this.storage, this.storageKey, clonedMainSessionData);
|
||||
}
|
||||
else {
|
||||
// No userStorage is configured.
|
||||
// In this case, session.user should ideally not be a proxy.
|
||||
// If it were, structuredClone would fail. This implies an issue elsewhere if user is a proxy here
|
||||
const clonedSession = (0, helpers_2.deepClone)(sessionToProcess); // sessionToProcess still has its original user property
|
||||
await (0, helpers_1.setItemAsync)(this.storage, this.storageKey, clonedSession);
|
||||
}
|
||||
}
|
||||
async _removeSession() {
|
||||
this._debug('#_removeSession()');
|
||||
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey);
|
||||
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey + '-code-verifier');
|
||||
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey + '-user');
|
||||
if (this.userStorage) {
|
||||
await (0, helpers_1.removeItemAsync)(this.userStorage, this.storageKey + '-user');
|
||||
}
|
||||
await this._notifyAllSubscribers('SIGNED_OUT', null);
|
||||
}
|
||||
/**
|
||||
@@ -1982,10 +2259,11 @@ class GoTrueClient {
|
||||
if (jwk) {
|
||||
return jwk;
|
||||
}
|
||||
const now = Date.now();
|
||||
// try fetching from cache
|
||||
jwk = this.jwks.keys.find((key) => key.kid === kid);
|
||||
// jwk exists and jwks isn't stale
|
||||
if (jwk && this.jwks_cached_at + constants_1.JWKS_TTL > Date.now()) {
|
||||
if (jwk && this.jwks_cached_at + constants_1.JWKS_TTL > now) {
|
||||
return jwk;
|
||||
}
|
||||
// jwk isn't cached in memory so we need to fetch it from the well-known endpoint
|
||||
@@ -1996,22 +2274,34 @@ class GoTrueClient {
|
||||
throw error;
|
||||
}
|
||||
if (!data.keys || data.keys.length === 0) {
|
||||
throw new errors_1.AuthInvalidJwtError('JWKS is empty');
|
||||
return null;
|
||||
}
|
||||
this.jwks = data;
|
||||
this.jwks_cached_at = Date.now();
|
||||
this.jwks_cached_at = now;
|
||||
// Find the signing key
|
||||
jwk = data.keys.find((key) => key.kid === kid);
|
||||
if (!jwk) {
|
||||
throw new errors_1.AuthInvalidJwtError('No matching signing key found in JWKS');
|
||||
return null;
|
||||
}
|
||||
return jwk;
|
||||
}
|
||||
/**
|
||||
* @experimental This method may change in future versions.
|
||||
* @description Gets the claims from a JWT. If the JWT is symmetric JWTs, it will call getUser() to verify against the server. If the JWT is asymmetric, it will be verified against the JWKS using the WebCrypto API.
|
||||
* Extracts the JWT claims present in the access token by first verifying the
|
||||
* JWT against the server's JSON Web Key Set endpoint
|
||||
* `/.well-known/jwks.json` which is often cached, resulting in significantly
|
||||
* faster responses. Prefer this method over {@link #getUser} which always
|
||||
* sends a request to the Auth server for each JWT.
|
||||
*
|
||||
* If the project is not using an asymmetric JWT signing key (like ECC or
|
||||
* RSA) it always sends a request to the Auth server (similar to {@link
|
||||
* #getUser}) to verify the JWT.
|
||||
*
|
||||
* @param jwt An optional specific JWT you wish to verify, not the one you
|
||||
* can obtain from {@link #getSession}.
|
||||
* @param options Various additional options that allow you to customize the
|
||||
* behavior of this method.
|
||||
*/
|
||||
async getClaims(jwt, jwks = { keys: [] }) {
|
||||
async getClaims(jwt, options = {}) {
|
||||
try {
|
||||
let token = jwt;
|
||||
if (!token) {
|
||||
@@ -2022,12 +2312,18 @@ class GoTrueClient {
|
||||
token = data.session.access_token;
|
||||
}
|
||||
const { header, payload, signature, raw: { header: rawHeader, payload: rawPayload }, } = (0, helpers_1.decodeJWT)(token);
|
||||
// Reject expired JWTs
|
||||
(0, helpers_1.validateExp)(payload.exp);
|
||||
if (!(options === null || options === void 0 ? void 0 : options.allowExpired)) {
|
||||
// Reject expired JWTs should only happen if jwt argument was passed
|
||||
(0, helpers_1.validateExp)(payload.exp);
|
||||
}
|
||||
const signingKey = !header.alg ||
|
||||
header.alg.startsWith('HS') ||
|
||||
!header.kid ||
|
||||
!('crypto' in globalThis && 'subtle' in globalThis.crypto)
|
||||
? null
|
||||
: await this.fetchJwk(header.kid, (options === null || options === void 0 ? void 0 : options.keys) ? { keys: options.keys } : options === null || options === void 0 ? void 0 : options.jwks);
|
||||
// If symmetric algorithm or WebCrypto API is unavailable, fallback to getUser()
|
||||
if (!header.kid ||
|
||||
header.alg === 'HS256' ||
|
||||
!('crypto' in globalThis && 'subtle' in globalThis.crypto)) {
|
||||
if (!signingKey) {
|
||||
const { error } = await this.getUser(token);
|
||||
if (error) {
|
||||
throw error;
|
||||
@@ -2043,7 +2339,6 @@ class GoTrueClient {
|
||||
};
|
||||
}
|
||||
const algorithm = (0, helpers_1.getAlgorithm)(header.alg);
|
||||
const signingKey = await this.fetchJwk(header.kid, jwks);
|
||||
// Convert JWK to CryptoKey
|
||||
const publicKey = await crypto.subtle.importKey('jwk', signingKey, algorithm, true, [
|
||||
'verify',
|
||||
|
||||
+2
-1
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = void 0;
|
||||
exports.processLock = exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = void 0;
|
||||
const GoTrueAdminApi_1 = __importDefault(require("./GoTrueAdminApi"));
|
||||
exports.GoTrueAdminApi = GoTrueAdminApi_1.default;
|
||||
const GoTrueClient_1 = __importDefault(require("./GoTrueClient"));
|
||||
@@ -32,4 +32,5 @@ var locks_1 = require("./lib/locks");
|
||||
Object.defineProperty(exports, "navigatorLock", { enumerable: true, get: function () { return locks_1.navigatorLock; } });
|
||||
Object.defineProperty(exports, "NavigatorLockAcquireTimeoutError", { enumerable: true, get: function () { return locks_1.NavigatorLockAcquireTimeoutError; } });
|
||||
Object.defineProperty(exports, "lockInternals", { enumerable: true, get: function () { return locks_1.internals; } });
|
||||
Object.defineProperty(exports, "processLock", { enumerable: true, get: function () { return locks_1.processLock; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
+13
-1
@@ -5,7 +5,7 @@
|
||||
* that repo!
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringToUint8Array = exports.base64UrlToUint8Array = exports.stringFromUTF8 = exports.stringToUTF8 = exports.codepointToUTF8 = exports.stringFromBase64URL = exports.stringToBase64URL = exports.byteFromBase64URL = exports.byteToBase64URL = void 0;
|
||||
exports.bytesToBase64URL = exports.stringToUint8Array = exports.base64UrlToUint8Array = exports.stringFromUTF8 = exports.stringToUTF8 = exports.codepointToUTF8 = exports.stringFromBase64URL = exports.stringToBase64URL = exports.byteFromBase64URL = exports.byteToBase64URL = void 0;
|
||||
/**
|
||||
* An array of characters that encode 6 bits into a Base64-URL alphabet
|
||||
* character.
|
||||
@@ -255,4 +255,16 @@ function stringToUint8Array(str) {
|
||||
return new Uint8Array(result);
|
||||
}
|
||||
exports.stringToUint8Array = stringToUint8Array;
|
||||
function bytesToBase64URL(bytes) {
|
||||
const result = [];
|
||||
const state = { queue: 0, queuedBits: 0 };
|
||||
const onChar = (char) => {
|
||||
result.push(char);
|
||||
};
|
||||
bytes.forEach((byte) => byteToBase64URL(byte, state, onChar));
|
||||
// always call with `null` after processing all bytes
|
||||
byteToBase64URL(null, state, onChar);
|
||||
return result.join('');
|
||||
}
|
||||
exports.bytesToBase64URL = bytesToBase64URL;
|
||||
//# sourceMappingURL=base64url.js.map
|
||||
+1
-1
@@ -27,5 +27,5 @@ exports.API_VERSIONS = {
|
||||
},
|
||||
};
|
||||
exports.BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
|
||||
exports.JWKS_TTL = 600000; // 10 minutes
|
||||
exports.JWKS_TTL = 10 * 60 * 1000; // 10 minutes
|
||||
//# sourceMappingURL=constants.js.map
|
||||
+45
-1
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getAlgorithm = exports.validateExp = exports.parseResponseAPIVersion = exports.getCodeChallengeAndMethod = exports.generatePKCEChallenge = exports.generatePKCEVerifier = exports.retryable = exports.sleep = exports.decodeJWT = exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.parseParametersFromURL = exports.supportsLocalStorage = exports.isBrowser = exports.uuid = exports.expiresAt = void 0;
|
||||
exports.deepClone = exports.userNotAvailableProxy = exports.validateUUID = exports.getAlgorithm = exports.validateExp = exports.parseResponseAPIVersion = exports.getCodeChallengeAndMethod = exports.generatePKCEChallenge = exports.generatePKCEVerifier = exports.retryable = exports.sleep = exports.decodeJWT = exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.parseParametersFromURL = exports.supportsLocalStorage = exports.isBrowser = exports.uuid = exports.expiresAt = void 0;
|
||||
const constants_1 = require("./constants");
|
||||
const errors_1 = require("./errors");
|
||||
const base64url_1 = require("./base64url");
|
||||
@@ -331,4 +331,48 @@ function getAlgorithm(alg) {
|
||||
}
|
||||
}
|
||||
exports.getAlgorithm = getAlgorithm;
|
||||
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
function validateUUID(str) {
|
||||
if (!UUID_REGEX.test(str)) {
|
||||
throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not');
|
||||
}
|
||||
}
|
||||
exports.validateUUID = validateUUID;
|
||||
function userNotAvailableProxy() {
|
||||
const proxyTarget = {};
|
||||
return new Proxy(proxyTarget, {
|
||||
get: (target, prop) => {
|
||||
if (prop === '__isUserNotAvailableProxy') {
|
||||
return true;
|
||||
}
|
||||
// Preventative check for common problematic symbols during cloning/inspection
|
||||
// These symbols might be accessed by structuredClone or other internal mechanisms.
|
||||
if (typeof prop === 'symbol') {
|
||||
const sProp = prop.toString();
|
||||
if (sProp === 'Symbol(Symbol.toPrimitive)' ||
|
||||
sProp === 'Symbol(Symbol.toStringTag)' ||
|
||||
sProp === 'Symbol(util.inspect.custom)') {
|
||||
// Node.js util.inspect
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${prop}" property of the session object is not supported. Please use getUser() instead.`);
|
||||
},
|
||||
set: (_target, prop) => {
|
||||
throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${prop}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`);
|
||||
},
|
||||
deleteProperty: (_target, prop) => {
|
||||
throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${prop}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`);
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.userNotAvailableProxy = userNotAvailableProxy;
|
||||
/**
|
||||
* Deep clones a JSON-serializable object using JSON.parse(JSON.stringify(obj)).
|
||||
* Note: Only works for JSON-safe data.
|
||||
*/
|
||||
function deepClone(obj) {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
exports.deepClone = deepClone;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
+1
-25
@@ -1,30 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.memoryLocalStorageAdapter = exports.localStorageAdapter = void 0;
|
||||
const helpers_1 = require("./helpers");
|
||||
/**
|
||||
* Provides safe access to the globalThis.localStorage property.
|
||||
*/
|
||||
exports.localStorageAdapter = {
|
||||
getItem: (key) => {
|
||||
if (!(0, helpers_1.supportsLocalStorage)()) {
|
||||
return null;
|
||||
}
|
||||
return globalThis.localStorage.getItem(key);
|
||||
},
|
||||
setItem: (key, value) => {
|
||||
if (!(0, helpers_1.supportsLocalStorage)()) {
|
||||
return;
|
||||
}
|
||||
globalThis.localStorage.setItem(key, value);
|
||||
},
|
||||
removeItem: (key) => {
|
||||
if (!(0, helpers_1.supportsLocalStorage)()) {
|
||||
return;
|
||||
}
|
||||
globalThis.localStorage.removeItem(key);
|
||||
},
|
||||
};
|
||||
exports.memoryLocalStorageAdapter = void 0;
|
||||
/**
|
||||
* Returns a localStorage-like object that stores the key-value pairs in
|
||||
* memory.
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SIGN_OUT_SCOPES = void 0;
|
||||
exports.SIGN_OUT_SCOPES = ['global', 'local', 'others'];
|
||||
//# sourceMappingURL=types.js.map
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = '2.69.1';
|
||||
exports.version = '2.71.1';
|
||||
//# sourceMappingURL=version.js.map
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@supabase/auth-js",
|
||||
"version": "2.69.1",
|
||||
"version": "2.71.1",
|
||||
"private": false,
|
||||
"description": "Official client library for Supabase Auth",
|
||||
"keywords": [
|
||||
@@ -30,7 +30,7 @@
|
||||
"build:module": "tsc -p tsconfig.module.json",
|
||||
"lint": "eslint ./src/**/* test/**/*.test.ts",
|
||||
"test": "run-s test:clean test:infra test:suite test:clean",
|
||||
"test:suite": "jest --runInBand --coverage",
|
||||
"test:suite": "npm --prefix ./test run test",
|
||||
"test:infra": "cd infra && docker compose down && docker compose pull && docker compose up -d && sleep 30",
|
||||
"test:clean": "cd infra && docker compose down",
|
||||
"docs": "typedoc src/index.ts --out docs/v2 --excludePrivate --excludeProtected",
|
||||
|
||||
+12
-3
@@ -41,8 +41,11 @@ class FunctionsClient {
|
||||
if (!region) {
|
||||
region = this.region;
|
||||
}
|
||||
// Add region as query parameter using URL API
|
||||
const url = new URL(`${this.url}/${functionName}`);
|
||||
if (region && region !== 'any') {
|
||||
_headers['x-region'] = region;
|
||||
url.searchParams.set('forceFunctionRegion', region);
|
||||
}
|
||||
let body;
|
||||
if (functionArgs &&
|
||||
@@ -70,7 +73,7 @@ class FunctionsClient {
|
||||
body = JSON.stringify(functionArgs);
|
||||
}
|
||||
}
|
||||
const response = yield this.fetch(`${this.url}/${functionName}`, {
|
||||
const response = yield this.fetch(url.toString(), {
|
||||
method: method || 'POST',
|
||||
// headers priority is (high to low):
|
||||
// 1. invoke-level headers
|
||||
@@ -106,10 +109,16 @@ class FunctionsClient {
|
||||
// default to text
|
||||
data = yield response.text();
|
||||
}
|
||||
return { data, error: null };
|
||||
return { data, error: null, response };
|
||||
}
|
||||
catch (error) {
|
||||
return { data: null, error };
|
||||
return {
|
||||
data: null,
|
||||
error,
|
||||
response: error instanceof types_1.FunctionsHttpError || error instanceof types_1.FunctionsRelayError
|
||||
? error.context
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@supabase/functions-js",
|
||||
"version": "2.4.4",
|
||||
"version": "2.4.5",
|
||||
"description": "JS Client library to interact with Supabase Functions.",
|
||||
"main": "dist/main/index.js",
|
||||
"module": "dist/module/index.js",
|
||||
|
||||
+37
-17
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
@@ -39,21 +49,21 @@ var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
|
||||
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT["INSERT"] = "INSERT";
|
||||
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT["UPDATE"] = "UPDATE";
|
||||
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT["DELETE"] = "DELETE";
|
||||
})(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT || (exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = {}));
|
||||
})(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT || (exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = {}));
|
||||
var REALTIME_LISTEN_TYPES;
|
||||
(function (REALTIME_LISTEN_TYPES) {
|
||||
REALTIME_LISTEN_TYPES["BROADCAST"] = "broadcast";
|
||||
REALTIME_LISTEN_TYPES["PRESENCE"] = "presence";
|
||||
REALTIME_LISTEN_TYPES["POSTGRES_CHANGES"] = "postgres_changes";
|
||||
REALTIME_LISTEN_TYPES["SYSTEM"] = "system";
|
||||
})(REALTIME_LISTEN_TYPES = exports.REALTIME_LISTEN_TYPES || (exports.REALTIME_LISTEN_TYPES = {}));
|
||||
})(REALTIME_LISTEN_TYPES || (exports.REALTIME_LISTEN_TYPES = REALTIME_LISTEN_TYPES = {}));
|
||||
var REALTIME_SUBSCRIBE_STATES;
|
||||
(function (REALTIME_SUBSCRIBE_STATES) {
|
||||
REALTIME_SUBSCRIBE_STATES["SUBSCRIBED"] = "SUBSCRIBED";
|
||||
REALTIME_SUBSCRIBE_STATES["TIMED_OUT"] = "TIMED_OUT";
|
||||
REALTIME_SUBSCRIBE_STATES["CLOSED"] = "CLOSED";
|
||||
REALTIME_SUBSCRIBE_STATES["CHANNEL_ERROR"] = "CHANNEL_ERROR";
|
||||
})(REALTIME_SUBSCRIBE_STATES = exports.REALTIME_SUBSCRIBE_STATES || (exports.REALTIME_SUBSCRIBE_STATES = {}));
|
||||
})(REALTIME_SUBSCRIBE_STATES || (exports.REALTIME_SUBSCRIBE_STATES = REALTIME_SUBSCRIBE_STATES = {}));
|
||||
exports.REALTIME_CHANNEL_STATES = constants_1.CHANNEL_STATES;
|
||||
/** A channel is the basic building block of Realtime
|
||||
* and narrows the scope of data flow to subscribed clients.
|
||||
@@ -122,10 +132,7 @@ class RealtimeChannel {
|
||||
if (!this.socket.isConnected()) {
|
||||
this.socket.connect();
|
||||
}
|
||||
if (this.joinedOnce) {
|
||||
throw `tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance`;
|
||||
}
|
||||
else {
|
||||
if (this.state == constants_1.CHANNEL_STATES.closed) {
|
||||
const { config: { broadcast, presence, private: isPrivate }, } = this.params;
|
||||
this._onError((e) => callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, e));
|
||||
this._onClose(() => callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CLOSED));
|
||||
@@ -167,6 +174,7 @@ class RealtimeChannel {
|
||||
}
|
||||
else {
|
||||
this.unsubscribe();
|
||||
this.state = constants_1.CHANNEL_STATES.errored;
|
||||
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error('mismatch between server and client bindings for postgres changes'));
|
||||
return;
|
||||
}
|
||||
@@ -177,6 +185,7 @@ class RealtimeChannel {
|
||||
}
|
||||
})
|
||||
.receive('error', (error) => {
|
||||
this.state = constants_1.CHANNEL_STATES.errored;
|
||||
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(JSON.stringify(Object.values(error).join(', ') || 'error')));
|
||||
return;
|
||||
})
|
||||
@@ -285,11 +294,10 @@ class RealtimeChannel {
|
||||
this.socket.log('channel', `leave ${this.topic}`);
|
||||
this._trigger(constants_1.CHANNEL_EVENTS.close, 'leave', this._joinRef());
|
||||
};
|
||||
this.rejoinTimer.reset();
|
||||
// Destroy joinPush to avoid connection timeouts during unscription phase
|
||||
this.joinPush.destroy();
|
||||
let leavePush = null;
|
||||
return new Promise((resolve) => {
|
||||
const leavePush = new push_1.default(this, constants_1.CHANNEL_EVENTS.leave, {}, timeout);
|
||||
leavePush = new push_1.default(this, constants_1.CHANNEL_EVENTS.leave, {}, timeout);
|
||||
leavePush
|
||||
.receive('ok', () => {
|
||||
onClose();
|
||||
@@ -306,8 +314,20 @@ class RealtimeChannel {
|
||||
if (!this._canPush()) {
|
||||
leavePush.trigger('ok', {});
|
||||
}
|
||||
}).finally(() => {
|
||||
leavePush === null || leavePush === void 0 ? void 0 : leavePush.destroy();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Teardown the channel.
|
||||
*
|
||||
* Destroys and stops related timers.
|
||||
*/
|
||||
teardown() {
|
||||
this.pushBuffer.forEach((push) => push.destroy());
|
||||
this.rejoinTimer && clearTimeout(this.rejoinTimer.timer);
|
||||
this.joinPush.destroy();
|
||||
}
|
||||
/** @internal */
|
||||
async _fetchWithTimeout(url, options, timeout) {
|
||||
const controller = new AbortController();
|
||||
|
||||
+101
-95
@@ -15,24 +15,34 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const isows_1 = require("isows");
|
||||
const constants_1 = require("./lib/constants");
|
||||
const serializer_1 = __importDefault(require("./lib/serializer"));
|
||||
const timer_1 = __importDefault(require("./lib/timer"));
|
||||
const transformers_1 = require("./lib/transformers");
|
||||
const RealtimeChannel_1 = __importDefault(require("./RealtimeChannel"));
|
||||
const noop = () => { };
|
||||
const NATIVE_WEBSOCKET_AVAILABLE = typeof WebSocket !== 'undefined';
|
||||
const WORKER_SCRIPT = `
|
||||
addEventListener("message", (e) => {
|
||||
if (e.data.event === "start") {
|
||||
@@ -45,12 +55,13 @@ class RealtimeClient {
|
||||
*
|
||||
* @param endPoint The string WebSocket endpoint, ie, "ws://example.com/socket", "wss://example.com", "/socket" (inherited host & protocol)
|
||||
* @param httpEndpoint The string HTTP endpoint, ie, "https://example.com", "/" (inherited host & protocol)
|
||||
* @param options.transport The Websocket Transport, for example WebSocket.
|
||||
* @param options.transport The Websocket Transport, for example WebSocket. This can be a custom implementation
|
||||
* @param options.timeout The default timeout in milliseconds to trigger push timeouts.
|
||||
* @param options.params The optional params to pass when connecting.
|
||||
* @param options.headers The optional headers to pass when connecting.
|
||||
* @param options.headers Deprecated: headers cannot be set on websocket connections and this option will be removed in the future.
|
||||
* @param options.heartbeatIntervalMs The millisec interval to send a heartbeat message.
|
||||
* @param options.logger The optional function for specialized logging, ie: logger: (kind, msg, data) => { console.log(`${kind}: ${msg}`, data) }
|
||||
* @param options.logLevel Sets the log level for Realtime
|
||||
* @param options.encode The function to encode outgoing messages. Defaults to JSON: (payload, callback) => callback(JSON.stringify(payload))
|
||||
* @param options.decode The function to decode incoming messages. Defaults to Serializer's decode.
|
||||
* @param options.reconnectAfterMs he optional function that returns the millsec reconnect interval. Defaults to stepped backoff off.
|
||||
@@ -61,15 +72,17 @@ class RealtimeClient {
|
||||
var _a;
|
||||
this.accessTokenValue = null;
|
||||
this.apiKey = null;
|
||||
this.channels = [];
|
||||
this.channels = new Array();
|
||||
this.endPoint = '';
|
||||
this.httpEndpoint = '';
|
||||
this.headers = constants_1.DEFAULT_HEADERS;
|
||||
/** @deprecated headers cannot be set on websocket connections */
|
||||
this.headers = {};
|
||||
this.params = {};
|
||||
this.timeout = constants_1.DEFAULT_TIMEOUT;
|
||||
this.heartbeatIntervalMs = 30000;
|
||||
this.heartbeatIntervalMs = 25000;
|
||||
this.heartbeatTimer = undefined;
|
||||
this.pendingHeartbeatRef = null;
|
||||
this.heartbeatCallback = noop;
|
||||
this.ref = 0;
|
||||
this.logger = noop;
|
||||
this.conn = null;
|
||||
@@ -93,7 +106,7 @@ class RealtimeClient {
|
||||
_fetch = customFetch;
|
||||
}
|
||||
else if (typeof fetch === 'undefined') {
|
||||
_fetch = (...args) => Promise.resolve().then(() => __importStar(require('@supabase/node-fetch'))).then(({ default: fetch }) => fetch(...args));
|
||||
_fetch = (...args) => Promise.resolve(`${'@supabase/node-fetch'}`).then(s => __importStar(require(s))).then(({ default: fetch }) => fetch(...args));
|
||||
}
|
||||
else {
|
||||
_fetch = fetch;
|
||||
@@ -110,12 +123,14 @@ class RealtimeClient {
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.params)
|
||||
this.params = options.params;
|
||||
if (options === null || options === void 0 ? void 0 : options.headers)
|
||||
this.headers = Object.assign(Object.assign({}, this.headers), options.headers);
|
||||
if (options === null || options === void 0 ? void 0 : options.timeout)
|
||||
this.timeout = options.timeout;
|
||||
if (options === null || options === void 0 ? void 0 : options.logger)
|
||||
this.logger = options.logger;
|
||||
if ((options === null || options === void 0 ? void 0 : options.logLevel) || (options === null || options === void 0 ? void 0 : options.log_level)) {
|
||||
this.logLevel = options.logLevel || options.log_level;
|
||||
this.params = Object.assign(Object.assign({}, this.params), { log_level: this.logLevel });
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.heartbeatIntervalMs)
|
||||
this.heartbeatIntervalMs = options.heartbeatIntervalMs;
|
||||
const accessTokenValue = (_a = options === null || options === void 0 ? void 0 : options.params) === null || _a === void 0 ? void 0 : _a.apikey;
|
||||
@@ -157,28 +172,14 @@ class RealtimeClient {
|
||||
if (this.conn) {
|
||||
return;
|
||||
}
|
||||
if (this.transport) {
|
||||
this.conn = new this.transport(this.endpointURL(), undefined, {
|
||||
headers: this.headers,
|
||||
});
|
||||
return;
|
||||
if (!this.transport) {
|
||||
this.transport = isows_1.WebSocket;
|
||||
}
|
||||
if (NATIVE_WEBSOCKET_AVAILABLE) {
|
||||
this.conn = new WebSocket(this.endpointURL());
|
||||
this.setupConnection();
|
||||
return;
|
||||
if (!this.transport) {
|
||||
throw new Error('No transport provided');
|
||||
}
|
||||
this.conn = new WSWebSocketDummy(this.endpointURL(), undefined, {
|
||||
close: () => {
|
||||
this.conn = null;
|
||||
},
|
||||
});
|
||||
Promise.resolve().then(() => __importStar(require('ws'))).then(({ default: WS }) => {
|
||||
this.conn = new WS(this.endpointURL(), undefined, {
|
||||
headers: this.headers,
|
||||
});
|
||||
this.setupConnection();
|
||||
});
|
||||
this.conn = new this.transport(this.endpointURL());
|
||||
this.setupConnection();
|
||||
}
|
||||
/**
|
||||
* Returns the URL of the websocket.
|
||||
@@ -206,6 +207,7 @@ class RealtimeClient {
|
||||
// remove open handles
|
||||
this.heartbeatTimer && clearInterval(this.heartbeatTimer);
|
||||
this.reconnectTimer.reset();
|
||||
this.channels.forEach((channel) => channel.teardown());
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -230,6 +232,7 @@ class RealtimeClient {
|
||||
*/
|
||||
async removeAllChannels() {
|
||||
const values_1 = await Promise.all(this.channels.map((channel) => channel.unsubscribe()));
|
||||
this.channels = [];
|
||||
this.disconnect();
|
||||
return values_1;
|
||||
}
|
||||
@@ -263,9 +266,16 @@ class RealtimeClient {
|
||||
return this.connectionState() === constants_1.CONNECTION_STATE.Open;
|
||||
}
|
||||
channel(topic, params = { config: {} }) {
|
||||
const chan = new RealtimeChannel_1.default(`realtime:${topic}`, params, this);
|
||||
this.channels.push(chan);
|
||||
return chan;
|
||||
const realtimeTopic = `realtime:${topic}`;
|
||||
const exists = this.getChannels().find((c) => c.topic === realtimeTopic);
|
||||
if (!exists) {
|
||||
const chan = new RealtimeChannel_1.default(`realtime:${topic}`, params, this);
|
||||
this.channels.push(chan);
|
||||
return chan;
|
||||
}
|
||||
else {
|
||||
return exists;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Push out a message if the socket is connected.
|
||||
@@ -301,23 +311,14 @@ class RealtimeClient {
|
||||
let tokenToSend = token ||
|
||||
(this.accessToken && (await this.accessToken())) ||
|
||||
this.accessTokenValue;
|
||||
if (tokenToSend) {
|
||||
let parsed = null;
|
||||
try {
|
||||
parsed = JSON.parse(atob(tokenToSend.split('.')[1]));
|
||||
}
|
||||
catch (_error) { }
|
||||
if (parsed && parsed.exp) {
|
||||
let now = Math.floor(Date.now() / 1000);
|
||||
let valid = now - parsed.exp < 0;
|
||||
if (!valid) {
|
||||
this.log('auth', `InvalidJWTToken: Invalid value for JWT claim "exp" with value ${parsed.exp}`);
|
||||
return Promise.reject(`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${parsed.exp}`);
|
||||
}
|
||||
}
|
||||
if (this.accessTokenValue != tokenToSend) {
|
||||
this.accessTokenValue = tokenToSend;
|
||||
this.channels.forEach((channel) => {
|
||||
tokenToSend && channel.updateJoinPayload({ access_token: tokenToSend });
|
||||
const payload = {
|
||||
access_token: tokenToSend,
|
||||
version: constants_1.DEFAULT_VERSION,
|
||||
};
|
||||
tokenToSend && channel.updateJoinPayload(payload);
|
||||
if (channel.joinedOnce && channel._isJoined()) {
|
||||
channel._push(constants_1.CHANNEL_EVENTS.access_token, {
|
||||
access_token: tokenToSend,
|
||||
@@ -332,11 +333,13 @@ class RealtimeClient {
|
||||
async sendHeartbeat() {
|
||||
var _a;
|
||||
if (!this.isConnected()) {
|
||||
this.heartbeatCallback('disconnected');
|
||||
return;
|
||||
}
|
||||
if (this.pendingHeartbeatRef) {
|
||||
this.pendingHeartbeatRef = null;
|
||||
this.log('transport', 'heartbeat timeout. Attempting to re-establish connection');
|
||||
this.heartbeatCallback('timeout');
|
||||
(_a = this.conn) === null || _a === void 0 ? void 0 : _a.close(constants_1.WS_CLOSE_NORMAL, 'hearbeat timeout');
|
||||
return;
|
||||
}
|
||||
@@ -347,7 +350,11 @@ class RealtimeClient {
|
||||
payload: {},
|
||||
ref: this.pendingHeartbeatRef,
|
||||
});
|
||||
this.setAuth();
|
||||
this.heartbeatCallback('sent');
|
||||
await this.setAuth();
|
||||
}
|
||||
onHeartbeat(callback) {
|
||||
this.heartbeatCallback = callback;
|
||||
}
|
||||
/**
|
||||
* Flushes send buffer
|
||||
@@ -393,7 +400,7 @@ class RealtimeClient {
|
||||
* @internal
|
||||
*/
|
||||
_remove(channel) {
|
||||
this.channels = this.channels.filter((c) => c._joinRef() !== channel._joinRef());
|
||||
this.channels = this.channels.filter((c) => c.topic !== channel.topic);
|
||||
}
|
||||
/**
|
||||
* Sets up connection handlers.
|
||||
@@ -413,51 +420,64 @@ class RealtimeClient {
|
||||
_onConnMessage(rawMessage) {
|
||||
this.decode(rawMessage.data, (msg) => {
|
||||
let { topic, event, payload, ref } = msg;
|
||||
if (topic === 'phoenix' && event === 'phx_reply') {
|
||||
this.heartbeatCallback(msg.payload.status == 'ok' ? 'ok' : 'error');
|
||||
}
|
||||
if (ref && ref === this.pendingHeartbeatRef) {
|
||||
this.pendingHeartbeatRef = null;
|
||||
}
|
||||
this.log('receive', `${payload.status || ''} ${topic} ${event} ${(ref && '(' + ref + ')') || ''}`, payload);
|
||||
this.channels
|
||||
Array.from(this.channels)
|
||||
.filter((channel) => channel._isMember(topic))
|
||||
.forEach((channel) => channel._trigger(event, payload, ref));
|
||||
this.stateChangeCallbacks.message.forEach((callback) => callback(msg));
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
async _onConnOpen() {
|
||||
_onConnOpen() {
|
||||
this.log('transport', `connected to ${this.endpointURL()}`);
|
||||
this.flushSendBuffer();
|
||||
this.reconnectTimer.reset();
|
||||
if (!this.worker) {
|
||||
this.heartbeatTimer && clearInterval(this.heartbeatTimer);
|
||||
this.heartbeatTimer = setInterval(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
|
||||
this._startHeartbeat();
|
||||
}
|
||||
else {
|
||||
if (this.workerUrl) {
|
||||
this.log('worker', `starting worker for from ${this.workerUrl}`);
|
||||
if (!this.workerRef) {
|
||||
this._startWorkerHeartbeat();
|
||||
}
|
||||
else {
|
||||
this.log('worker', `starting default worker`);
|
||||
}
|
||||
const objectUrl = this._workerObjectUrl(this.workerUrl);
|
||||
this.workerRef = new Worker(objectUrl);
|
||||
this.workerRef.onerror = (error) => {
|
||||
this.log('worker', 'worker error', error.message);
|
||||
this.workerRef.terminate();
|
||||
};
|
||||
this.workerRef.onmessage = (event) => {
|
||||
if (event.data.event === 'keepAlive') {
|
||||
this.sendHeartbeat();
|
||||
}
|
||||
};
|
||||
this.workerRef.postMessage({
|
||||
event: 'start',
|
||||
interval: this.heartbeatIntervalMs,
|
||||
});
|
||||
}
|
||||
this.stateChangeCallbacks.open.forEach((callback) => callback());
|
||||
}
|
||||
/** @internal */
|
||||
_startHeartbeat() {
|
||||
this.heartbeatTimer && clearInterval(this.heartbeatTimer);
|
||||
this.heartbeatTimer = setInterval(() => this.sendHeartbeat(), this.heartbeatIntervalMs);
|
||||
}
|
||||
/** @internal */
|
||||
_startWorkerHeartbeat() {
|
||||
if (this.workerUrl) {
|
||||
this.log('worker', `starting worker for from ${this.workerUrl}`);
|
||||
}
|
||||
else {
|
||||
this.log('worker', `starting default worker`);
|
||||
}
|
||||
const objectUrl = this._workerObjectUrl(this.workerUrl);
|
||||
this.workerRef = new Worker(objectUrl);
|
||||
this.workerRef.onerror = (error) => {
|
||||
this.log('worker', 'worker error', error.message);
|
||||
this.workerRef.terminate();
|
||||
};
|
||||
this.workerRef.onmessage = (event) => {
|
||||
if (event.data.event === 'keepAlive') {
|
||||
this.sendHeartbeat();
|
||||
}
|
||||
};
|
||||
this.workerRef.postMessage({
|
||||
event: 'start',
|
||||
interval: this.heartbeatIntervalMs,
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
_onConnClose(event) {
|
||||
this.log('transport', 'close', event);
|
||||
this._triggerChanError();
|
||||
@@ -467,7 +487,7 @@ class RealtimeClient {
|
||||
}
|
||||
/** @internal */
|
||||
_onConnError(error) {
|
||||
this.log('transport', error.message);
|
||||
this.log('transport', `${error}`);
|
||||
this._triggerChanError();
|
||||
this.stateChangeCallbacks.error.forEach((callback) => callback(error));
|
||||
}
|
||||
@@ -497,18 +517,4 @@ class RealtimeClient {
|
||||
}
|
||||
}
|
||||
exports.default = RealtimeClient;
|
||||
class WSWebSocketDummy {
|
||||
constructor(address, _protocols, options) {
|
||||
this.binaryType = 'arraybuffer';
|
||||
this.onclose = () => { };
|
||||
this.onerror = () => { };
|
||||
this.onmessage = () => { };
|
||||
this.onopen = () => { };
|
||||
this.readyState = constants_1.SOCKET_STATES.connecting;
|
||||
this.send = () => { };
|
||||
this.url = null;
|
||||
this.url = address;
|
||||
this.close = options.close;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=RealtimeClient.js.map
|
||||
+1
-1
@@ -10,7 +10,7 @@ var REALTIME_PRESENCE_LISTEN_EVENTS;
|
||||
REALTIME_PRESENCE_LISTEN_EVENTS["SYNC"] = "sync";
|
||||
REALTIME_PRESENCE_LISTEN_EVENTS["JOIN"] = "join";
|
||||
REALTIME_PRESENCE_LISTEN_EVENTS["LEAVE"] = "leave";
|
||||
})(REALTIME_PRESENCE_LISTEN_EVENTS = exports.REALTIME_PRESENCE_LISTEN_EVENTS || (exports.REALTIME_PRESENCE_LISTEN_EVENTS = {}));
|
||||
})(REALTIME_PRESENCE_LISTEN_EVENTS || (exports.REALTIME_PRESENCE_LISTEN_EVENTS = REALTIME_PRESENCE_LISTEN_EVENTS = {}));
|
||||
class RealtimePresence {
|
||||
/**
|
||||
* Initializes the Presence.
|
||||
|
||||
+17
-7
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
+8
-7
@@ -1,9 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VSN = exports.DEFAULT_HEADERS = void 0;
|
||||
exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VERSION = exports.VSN = exports.DEFAULT_VERSION = void 0;
|
||||
const version_1 = require("./version");
|
||||
exports.DEFAULT_HEADERS = { 'X-Client-Info': `realtime-js/${version_1.version}` };
|
||||
exports.DEFAULT_VERSION = `realtime-js/${version_1.version}`;
|
||||
exports.VSN = '1.0.0';
|
||||
exports.VERSION = version_1.version;
|
||||
exports.DEFAULT_TIMEOUT = 10000;
|
||||
exports.WS_CLOSE_NORMAL = 1000;
|
||||
var SOCKET_STATES;
|
||||
@@ -12,7 +13,7 @@ var SOCKET_STATES;
|
||||
SOCKET_STATES[SOCKET_STATES["open"] = 1] = "open";
|
||||
SOCKET_STATES[SOCKET_STATES["closing"] = 2] = "closing";
|
||||
SOCKET_STATES[SOCKET_STATES["closed"] = 3] = "closed";
|
||||
})(SOCKET_STATES = exports.SOCKET_STATES || (exports.SOCKET_STATES = {}));
|
||||
})(SOCKET_STATES || (exports.SOCKET_STATES = SOCKET_STATES = {}));
|
||||
var CHANNEL_STATES;
|
||||
(function (CHANNEL_STATES) {
|
||||
CHANNEL_STATES["closed"] = "closed";
|
||||
@@ -20,7 +21,7 @@ var CHANNEL_STATES;
|
||||
CHANNEL_STATES["joined"] = "joined";
|
||||
CHANNEL_STATES["joining"] = "joining";
|
||||
CHANNEL_STATES["leaving"] = "leaving";
|
||||
})(CHANNEL_STATES = exports.CHANNEL_STATES || (exports.CHANNEL_STATES = {}));
|
||||
})(CHANNEL_STATES || (exports.CHANNEL_STATES = CHANNEL_STATES = {}));
|
||||
var CHANNEL_EVENTS;
|
||||
(function (CHANNEL_EVENTS) {
|
||||
CHANNEL_EVENTS["close"] = "phx_close";
|
||||
@@ -29,16 +30,16 @@ var CHANNEL_EVENTS;
|
||||
CHANNEL_EVENTS["reply"] = "phx_reply";
|
||||
CHANNEL_EVENTS["leave"] = "phx_leave";
|
||||
CHANNEL_EVENTS["access_token"] = "access_token";
|
||||
})(CHANNEL_EVENTS = exports.CHANNEL_EVENTS || (exports.CHANNEL_EVENTS = {}));
|
||||
})(CHANNEL_EVENTS || (exports.CHANNEL_EVENTS = CHANNEL_EVENTS = {}));
|
||||
var TRANSPORTS;
|
||||
(function (TRANSPORTS) {
|
||||
TRANSPORTS["websocket"] = "websocket";
|
||||
})(TRANSPORTS = exports.TRANSPORTS || (exports.TRANSPORTS = {}));
|
||||
})(TRANSPORTS || (exports.TRANSPORTS = TRANSPORTS = {}));
|
||||
var CONNECTION_STATE;
|
||||
(function (CONNECTION_STATE) {
|
||||
CONNECTION_STATE["Connecting"] = "connecting";
|
||||
CONNECTION_STATE["Open"] = "open";
|
||||
CONNECTION_STATE["Closing"] = "closing";
|
||||
CONNECTION_STATE["Closed"] = "closed";
|
||||
})(CONNECTION_STATE = exports.CONNECTION_STATE || (exports.CONNECTION_STATE = {}));
|
||||
})(CONNECTION_STATE || (exports.CONNECTION_STATE = CONNECTION_STATE = {}));
|
||||
//# sourceMappingURL=constants.js.map
|
||||
+1
-1
@@ -32,7 +32,7 @@ var PostgresTypes;
|
||||
PostgresTypes["timetz"] = "timetz";
|
||||
PostgresTypes["tsrange"] = "tsrange";
|
||||
PostgresTypes["tstzrange"] = "tstzrange";
|
||||
})(PostgresTypes = exports.PostgresTypes || (exports.PostgresTypes = {}));
|
||||
})(PostgresTypes || (exports.PostgresTypes = PostgresTypes = {}));
|
||||
/**
|
||||
* Takes an array of columns and an object of string values then converts each string value
|
||||
* to its mapped type.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = '2.11.2';
|
||||
exports.version = '2.11.15';
|
||||
//# sourceMappingURL=version.js.map
|
||||
+15
-14
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@supabase/realtime-js",
|
||||
"version": "2.11.2",
|
||||
"version": "2.11.15",
|
||||
"description": "Listen to realtime updates to your PostgreSQL database",
|
||||
"keywords": [
|
||||
"realtime",
|
||||
@@ -38,16 +38,17 @@
|
||||
"ci": "run-s test coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@supabase/node-fetch": "^2.6.14",
|
||||
"@types/phoenix": "^1.5.4",
|
||||
"@types/ws": "^8.5.10",
|
||||
"ws": "^8.18.0"
|
||||
"@supabase/node-fetch": "^2.6.13",
|
||||
"@types/phoenix": "^1.6.6",
|
||||
"isows": "^1.0.7",
|
||||
"@types/ws": "^8.18.1",
|
||||
"ws": "^8.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.16.2",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"eslint": "^7.0.0",
|
||||
"@arethetypeswrong/cli": "^0.16.4",
|
||||
"@types/sinon": "^17.0.4",
|
||||
"@vitest/coverage-v8": "^3.1.4",
|
||||
"eslint": "^9.27.0",
|
||||
"esm": "^3.2.25",
|
||||
"jsdom": "^16.7.0",
|
||||
"jsdom-global": "3.0.0",
|
||||
@@ -55,12 +56,12 @@
|
||||
"mock-socket": "^9.3.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.1.2",
|
||||
"prettier": "^2.8.8",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.1.0",
|
||||
"sinon": "^18.0.0",
|
||||
"typedoc": "^0.22.16",
|
||||
"typescript": "^4.0.3",
|
||||
"vitest": "^2.0.5",
|
||||
"sinon": "^18.0.1",
|
||||
"typedoc": "^0.27.9",
|
||||
"typescript": "^5.8.3",
|
||||
"vitest": "^3.1.4",
|
||||
"web-worker": "1.2.0"
|
||||
}
|
||||
}
|
||||
+20
@@ -38,4 +38,24 @@ const createClient = (supabaseUrl, supabaseKey, options) => {
|
||||
return new SupabaseClient_1.default(supabaseUrl, supabaseKey, options);
|
||||
};
|
||||
exports.createClient = createClient;
|
||||
// Check for Node.js <= 18 deprecation
|
||||
function shouldShowDeprecationWarning() {
|
||||
if (typeof window !== 'undefined' ||
|
||||
typeof process === 'undefined' ||
|
||||
process.version === undefined ||
|
||||
process.version === null) {
|
||||
return false;
|
||||
}
|
||||
const versionMatch = process.version.match(/^v(\d+)\./);
|
||||
if (!versionMatch) {
|
||||
return false;
|
||||
}
|
||||
const majorVersion = parseInt(versionMatch[1], 10);
|
||||
return majorVersion <= 18;
|
||||
}
|
||||
if (shouldShowDeprecationWarning()) {
|
||||
console.warn(`⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +
|
||||
`Please upgrade to Node.js 20 or later. ` +
|
||||
`For more information, visit: https://github.com/orgs/supabase/discussions/37217`);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = '2.49.8';
|
||||
exports.version = '2.52.1';
|
||||
//# sourceMappingURL=version.js.map
|
||||
+26
-13
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@supabase/supabase-js",
|
||||
"version": "2.49.8",
|
||||
"version": "2.52.1",
|
||||
"description": "Isomorphic Javascript client for Supabase",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
@@ -26,35 +26,47 @@
|
||||
"build": "run-s clean format build:*",
|
||||
"build:main": "tsc -p tsconfig.json",
|
||||
"build:module": "tsc -p tsconfig.module.json",
|
||||
"build:umd": "webpack",
|
||||
"build:umd": "webpack --env mode=production",
|
||||
"types-generate": "dts-gen -m '@supabase/supabase-js' -s",
|
||||
"test": "run-s test:types test:run",
|
||||
"test:run": "jest --runInBand",
|
||||
"test:coverage": "jest --runInBand --coverage",
|
||||
"test:db": "cd infra/db && docker-compose down && docker-compose up -d && sleep 5",
|
||||
"test:all": "run-s test:types test:run test:integration test:integration:browser",
|
||||
"test:run": "jest --runInBand --detectOpenHandles",
|
||||
"test:unit": "jest --runInBand --detectOpenHandles test/unit",
|
||||
"test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
|
||||
"test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
|
||||
"test:integration:browser": "deno test --allow-all test/integration.browser.test.ts",
|
||||
"test:watch": "jest --watch --verbose false --silent false",
|
||||
"test:clean": "cd infra/db && docker-compose down",
|
||||
"test:types": "run-s build:module && tsd --files test/*.test-d.ts",
|
||||
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
|
||||
"test:bun": "cd test/integration/bun && bun install && bun test",
|
||||
"test:types": "run-s build:module && tsd --files test/types/*.test-d.ts && jsr publish --dry-run",
|
||||
"docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts",
|
||||
"docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals",
|
||||
"serve:coverage": "npm run test:coverage && serve test/coverage"
|
||||
"serve:coverage": "npm run test:coverage && serve test/coverage",
|
||||
"update:test-deps": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/expo/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/integration/next/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/expo && npm install && cd ../next && npm install --legacy-peer-deps && cd ../../deno && npm install && cd ../integration/bun && bun install",
|
||||
"update:test-deps:expo": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/expo/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/expo && npm install",
|
||||
"update:test-deps:next": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/next/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/next && npm install --legacy-peer-deps",
|
||||
"update:test-deps:deno": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cd test/deno && npm install",
|
||||
"update:test-deps:bun": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/bun && bun install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@supabase/auth-js": "2.69.1",
|
||||
"@supabase/functions-js": "2.4.4",
|
||||
"@supabase/auth-js": "2.71.1",
|
||||
"@supabase/functions-js": "2.4.5",
|
||||
"@supabase/node-fetch": "2.6.15",
|
||||
"@supabase/postgrest-js": "1.19.4",
|
||||
"@supabase/realtime-js": "2.11.2",
|
||||
"@supabase/realtime-js": "2.11.15",
|
||||
"@supabase/storage-js": "2.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sebbo2002/semantic-release-jsr": "^1.0.0",
|
||||
"@solana/wallet-standard-features": "^1.3.0",
|
||||
"@types/jest": "^29.2.5",
|
||||
"husky": "^4.3.0",
|
||||
"husky": "^4.3.8",
|
||||
"jest": "^29.3.1",
|
||||
"jsr": "^0.13.5",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.5.1",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"puppeteer": "^24.9.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.1.0",
|
||||
"serve": "^14.2.1",
|
||||
@@ -73,5 +85,6 @@
|
||||
}
|
||||
},
|
||||
"jsdelivr": "dist/umd/supabase.js",
|
||||
"unpkg": "dist/umd/supabase.js"
|
||||
"unpkg": "dist/umd/supabase.js",
|
||||
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
|
||||
}
|
||||
+38
-33
@@ -183,7 +183,6 @@ class Virtualizer {
|
||||
this.scrollElement = null;
|
||||
this.targetWindow = null;
|
||||
this.isScrolling = false;
|
||||
this.scrollToIndexTimeoutId = null;
|
||||
this.measurementsCache = [];
|
||||
this.itemSizeCache = /* @__PURE__ */ new Map();
|
||||
this.pendingMeasuredCacheIndexes = [];
|
||||
@@ -599,7 +598,7 @@ class Virtualizer {
|
||||
} else if (align === "end") {
|
||||
toOffset -= size;
|
||||
}
|
||||
const maxOffset = this.getTotalSize() - size;
|
||||
const maxOffset = this.getTotalSize() + this.options.scrollMargin - size;
|
||||
return Math.max(Math.min(maxOffset, toOffset), 0);
|
||||
};
|
||||
this.getOffsetForIndex = (index, align = "auto") => {
|
||||
@@ -626,14 +625,7 @@ class Virtualizer {
|
||||
];
|
||||
};
|
||||
this.isDynamicMode = () => this.elementsCache.size > 0;
|
||||
this.cancelScrollToIndex = () => {
|
||||
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
||||
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
||||
this.scrollToIndexTimeoutId = null;
|
||||
}
|
||||
};
|
||||
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
||||
this.cancelScrollToIndex();
|
||||
if (behavior === "smooth" && this.isDynamicMode()) {
|
||||
console.warn(
|
||||
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
||||
@@ -645,39 +637,52 @@ class Virtualizer {
|
||||
});
|
||||
};
|
||||
this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => {
|
||||
index = Math.max(0, Math.min(index, this.options.count - 1));
|
||||
this.cancelScrollToIndex();
|
||||
if (behavior === "smooth" && this.isDynamicMode()) {
|
||||
console.warn(
|
||||
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
||||
);
|
||||
}
|
||||
const offsetAndAlign = this.getOffsetForIndex(index, initialAlign);
|
||||
if (!offsetAndAlign) return;
|
||||
const [offset, align] = offsetAndAlign;
|
||||
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
||||
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
|
||||
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
||||
this.scrollToIndexTimeoutId = null;
|
||||
const elementInDOM = this.elementsCache.has(
|
||||
this.options.getItemKey(index)
|
||||
);
|
||||
if (elementInDOM) {
|
||||
const result = this.getOffsetForIndex(index, align);
|
||||
if (!result) return;
|
||||
const [latestOffset] = result;
|
||||
const currentScrollOffset = this.getScrollOffset();
|
||||
if (!approxEqual(latestOffset, currentScrollOffset)) {
|
||||
this.scrollToIndex(index, { align, behavior });
|
||||
}
|
||||
} else {
|
||||
this.scrollToIndex(index, { align, behavior });
|
||||
index = Math.max(0, Math.min(index, this.options.count - 1));
|
||||
let attempts = 0;
|
||||
const maxAttempts = 10;
|
||||
const tryScroll = (currentAlign) => {
|
||||
if (!this.targetWindow) return;
|
||||
const offsetInfo = this.getOffsetForIndex(index, currentAlign);
|
||||
if (!offsetInfo) {
|
||||
console.warn("Failed to get offset for index:", index);
|
||||
return;
|
||||
}
|
||||
const [offset, align] = offsetInfo;
|
||||
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
||||
this.targetWindow.requestAnimationFrame(() => {
|
||||
const currentOffset = this.getScrollOffset();
|
||||
const afterInfo = this.getOffsetForIndex(index, align);
|
||||
if (!afterInfo) {
|
||||
console.warn("Failed to get offset for index:", index);
|
||||
return;
|
||||
}
|
||||
if (!approxEqual(afterInfo[0], currentOffset)) {
|
||||
scheduleRetry(align);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const scheduleRetry = (align) => {
|
||||
if (!this.targetWindow) return;
|
||||
attempts++;
|
||||
if (attempts < maxAttempts) {
|
||||
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
||||
console.info("Schedule retry", attempts, maxAttempts);
|
||||
}
|
||||
this.targetWindow.requestAnimationFrame(() => tryScroll(align));
|
||||
} else {
|
||||
console.warn(
|
||||
`Failed to scroll to index ${index} after ${maxAttempts} attempts.`
|
||||
);
|
||||
}
|
||||
};
|
||||
tryScroll(initialAlign);
|
||||
};
|
||||
this.scrollBy = (delta, { behavior } = {}) => {
|
||||
this.cancelScrollToIndex();
|
||||
if (behavior === "smooth" && this.isDynamicMode()) {
|
||||
console.warn(
|
||||
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ function notUndefined(value, msg) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const approxEqual = (a, b) => Math.abs(a - b) <= 1;
|
||||
const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
||||
const debounce = (targetWindow, fn, ms) => {
|
||||
let timeoutId;
|
||||
return function(...args) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tanstack/virtual-core",
|
||||
"version": "3.13.9",
|
||||
"version": "3.13.12",
|
||||
"description": "Headless UI for virtualizing scrollable elements in TS/JS + Frameworks",
|
||||
"author": "Tanner Linsley",
|
||||
"license": "MIT",
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tanstack/vue-virtual",
|
||||
"version": "3.13.9",
|
||||
"version": "3.13.12",
|
||||
"description": "Headless UI for virtualizing scrollable elements in Vue",
|
||||
"author": "Tanner Linsley",
|
||||
"license": "MIT",
|
||||
@@ -49,11 +49,11 @@
|
||||
"src"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tanstack/virtual-core": "3.13.9"
|
||||
"@tanstack/virtual-core": "3.13.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.4",
|
||||
"vue": "^3.5.14"
|
||||
"vue": "^3.5.16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^2.7.0 || ^3.0.0"
|
||||
|
||||
+39
-23
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/compiler-core v3.5.14
|
||||
* @vue/compiler-core v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -1063,7 +1063,7 @@ class Tokenizer {
|
||||
this.buffer = input;
|
||||
while (this.index < this.buffer.length) {
|
||||
const c = this.buffer.charCodeAt(this.index);
|
||||
if (c === 10) {
|
||||
if (c === 10 && this.state !== 33) {
|
||||
this.newlines.push(this.index);
|
||||
}
|
||||
switch (this.state) {
|
||||
@@ -1602,14 +1602,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
||||
if (id.name === "arguments") {
|
||||
return false;
|
||||
}
|
||||
if (isReferenced(id, parent)) {
|
||||
if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
|
||||
return true;
|
||||
}
|
||||
switch (parent.type) {
|
||||
case "AssignmentExpression":
|
||||
case "AssignmentPattern":
|
||||
return true;
|
||||
case "ObjectPattern":
|
||||
case "ObjectProperty":
|
||||
return parent.key !== id && isInDestructureAssignment(parent, parentStack);
|
||||
case "ArrayPattern":
|
||||
return isInDestructureAssignment(parent, parentStack);
|
||||
}
|
||||
@@ -1778,7 +1779,7 @@ function isReferenced(node, parent, grandparent) {
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
return true;
|
||||
return !grandparent || grandparent.type !== "ObjectPattern";
|
||||
// no: class { NODE = value; }
|
||||
// yes: class { [NODE] = value; }
|
||||
// yes: class { key = NODE; }
|
||||
@@ -1828,6 +1829,9 @@ function isReferenced(node, parent, grandparent) {
|
||||
// yes: export { NODE as foo };
|
||||
// no: export { NODE as foo } from "foo";
|
||||
case "ExportSpecifier":
|
||||
if (grandparent == null ? void 0 : grandparent.source) {
|
||||
return false;
|
||||
}
|
||||
return parent.local === node;
|
||||
// no: import NODE from "foo";
|
||||
// no: import * as NODE from "foo";
|
||||
@@ -1908,7 +1912,7 @@ function isCoreComponent(tag) {
|
||||
return BASE_TRANSITION;
|
||||
}
|
||||
}
|
||||
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
||||
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
||||
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
||||
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
||||
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
||||
@@ -2073,6 +2077,9 @@ function hasDynamicKeyVBind(node) {
|
||||
function isText$1(node) {
|
||||
return node.type === 5 || node.type === 2;
|
||||
}
|
||||
function isVPre(p) {
|
||||
return p.type === 7 && p.name === "pre";
|
||||
}
|
||||
function isVSlot(p) {
|
||||
return p.type === 7 && p.name === "slot";
|
||||
}
|
||||
@@ -2371,7 +2378,7 @@ const tokenizer = new Tokenizer(stack, {
|
||||
ondirarg(start, end) {
|
||||
if (start === end) return;
|
||||
const arg = getSlice(start, end);
|
||||
if (inVPre) {
|
||||
if (inVPre && !isVPre(currentProp)) {
|
||||
currentProp.name += arg;
|
||||
setLocEnd(currentProp.nameLoc, end);
|
||||
} else {
|
||||
@@ -2386,7 +2393,7 @@ const tokenizer = new Tokenizer(stack, {
|
||||
},
|
||||
ondirmodifier(start, end) {
|
||||
const mod = getSlice(start, end);
|
||||
if (inVPre) {
|
||||
if (inVPre && !isVPre(currentProp)) {
|
||||
currentProp.name += "." + mod;
|
||||
setLocEnd(currentProp.nameLoc, end);
|
||||
} else if (currentProp.name === "slot") {
|
||||
@@ -2779,7 +2786,7 @@ function isUpperCase(c) {
|
||||
return c > 64 && c < 91;
|
||||
}
|
||||
const windowsNewlineRE = /\r\n/g;
|
||||
function condenseWhitespace(nodes, tag) {
|
||||
function condenseWhitespace(nodes) {
|
||||
const shouldCondense = currentOptions.whitespace !== "preserve";
|
||||
let removedWhitespace = false;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
@@ -2958,12 +2965,12 @@ function cacheStatic(root, context) {
|
||||
context,
|
||||
// Root node is unfortunately non-hoistable due to potential parent
|
||||
// fallthrough attributes.
|
||||
isSingleElementRoot(root, root.children[0])
|
||||
!!getSingleElementRoot(root)
|
||||
);
|
||||
}
|
||||
function isSingleElementRoot(root, child) {
|
||||
const { children } = root;
|
||||
return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
|
||||
function getSingleElementRoot(root) {
|
||||
const children = root.children.filter((x) => x.type !== 3);
|
||||
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
||||
}
|
||||
function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
||||
const { children } = node;
|
||||
@@ -2996,6 +3003,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
||||
} else if (child.type === 12) {
|
||||
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
||||
if (constantType >= 2) {
|
||||
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
||||
child.codegenNode.arguments.push(
|
||||
-1 + (``)
|
||||
);
|
||||
}
|
||||
toCache.push(child);
|
||||
continue;
|
||||
}
|
||||
@@ -3443,15 +3455,15 @@ function createRootCodegen(root, context) {
|
||||
const { helper } = context;
|
||||
const { children } = root;
|
||||
if (children.length === 1) {
|
||||
const child = children[0];
|
||||
if (isSingleElementRoot(root, child) && child.codegenNode) {
|
||||
const codegenNode = child.codegenNode;
|
||||
const singleElementRootChild = getSingleElementRoot(root);
|
||||
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
||||
const codegenNode = singleElementRootChild.codegenNode;
|
||||
if (codegenNode.type === 13) {
|
||||
convertToBlock(codegenNode, context);
|
||||
}
|
||||
root.codegenNode = codegenNode;
|
||||
} else {
|
||||
root.codegenNode = child;
|
||||
root.codegenNode = children[0];
|
||||
}
|
||||
} else if (children.length > 1) {
|
||||
let patchFlag = 64;
|
||||
@@ -3607,7 +3619,9 @@ function createCodegenContext(ast, {
|
||||
name = content;
|
||||
}
|
||||
}
|
||||
addMapping(node.loc.start, name);
|
||||
if (node.loc.source) {
|
||||
addMapping(node.loc.start, name);
|
||||
}
|
||||
}
|
||||
if (newlineIndex === -3 /* Unknown */) {
|
||||
advancePositionWithMutation(context, code);
|
||||
@@ -3623,7 +3637,7 @@ function createCodegenContext(ast, {
|
||||
context.column = code.length - newlineIndex;
|
||||
}
|
||||
}
|
||||
if (node && node.loc !== locStub) {
|
||||
if (node && node.loc !== locStub && node.loc.source) {
|
||||
addMapping(node.loc.end);
|
||||
}
|
||||
}
|
||||
@@ -4790,7 +4804,7 @@ const transformBind = (dir, _node, context) => {
|
||||
arg.children.unshift(`(`);
|
||||
arg.children.push(`) || ""`);
|
||||
} else if (!arg.isStatic) {
|
||||
arg.content = `${arg.content} || ""`;
|
||||
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
||||
}
|
||||
if (modifiers.some((mod) => mod.content === "camel")) {
|
||||
if (arg.type === 4) {
|
||||
@@ -5203,7 +5217,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
||||
let prev;
|
||||
while (j--) {
|
||||
prev = children[j];
|
||||
if (prev.type !== 3) {
|
||||
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5698,9 +5712,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
||||
hasDynamicKeys = true;
|
||||
if (exp) {
|
||||
if (isVBind) {
|
||||
pushRefVForMarker();
|
||||
pushMergeArg();
|
||||
{
|
||||
pushMergeArg();
|
||||
if (isCompatEnabled(
|
||||
"COMPILER_V_BIND_OBJECT_ORDER",
|
||||
context
|
||||
@@ -5709,6 +5722,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
||||
continue;
|
||||
}
|
||||
}
|
||||
pushRefVForMarker();
|
||||
pushMergeArg();
|
||||
mergeArgs.push(exp);
|
||||
} else {
|
||||
pushMergeArg({
|
||||
@@ -6675,6 +6690,7 @@ exports.isStaticProperty = isStaticProperty;
|
||||
exports.isStaticPropertyKey = isStaticPropertyKey;
|
||||
exports.isTemplateNode = isTemplateNode;
|
||||
exports.isText = isText$1;
|
||||
exports.isVPre = isVPre;
|
||||
exports.isVSlot = isVSlot;
|
||||
exports.locStub = locStub;
|
||||
exports.noopDirectiveTransform = noopDirectiveTransform;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
@@ -46,13 +46,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.27.2",
|
||||
"@babel/parser": "^7.28.0",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.2.1",
|
||||
"@vue/shared": "3.5.14"
|
||||
"@vue/shared": "3.5.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.27.1"
|
||||
"@babel/types": "^7.28.1"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/compiler-dom v3.5.14
|
||||
* @vue/compiler-dom v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
@@ -51,7 +51,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/compiler-core": "3.5.14"
|
||||
"@vue/compiler-core": "3.5.18",
|
||||
"@vue/shared": "3.5.18"
|
||||
}
|
||||
}
|
||||
+14
-16
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/compiler-ssr v3.5.14
|
||||
* @vue/compiler-ssr v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -1086,6 +1086,17 @@ const ssrTransformModel = (dir, node, context) => {
|
||||
);
|
||||
}
|
||||
}
|
||||
const processSelectChildren = (children) => {
|
||||
children.forEach((child) => {
|
||||
if (child.type === 1) {
|
||||
processOption(child);
|
||||
} else if (child.type === 11) {
|
||||
processSelectChildren(child.children);
|
||||
} else if (child.type === 9) {
|
||||
child.branches.forEach((b) => processSelectChildren(b.children));
|
||||
}
|
||||
});
|
||||
};
|
||||
function processOption(plainNode) {
|
||||
if (plainNode.tag === "option") {
|
||||
if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
|
||||
@@ -1112,9 +1123,7 @@ const ssrTransformModel = (dir, node, context) => {
|
||||
);
|
||||
}
|
||||
} else if (plainNode.tag === "optgroup") {
|
||||
plainNode.children.forEach(
|
||||
(option) => processOption(option)
|
||||
);
|
||||
processSelectChildren(plainNode.children);
|
||||
}
|
||||
}
|
||||
if (node.tagType === 0) {
|
||||
@@ -1199,18 +1208,7 @@ const ssrTransformModel = (dir, node, context) => {
|
||||
checkDuplicatedValue();
|
||||
node.children = [compilerDom.createInterpolation(model, model.loc)];
|
||||
} else if (node.tag === "select") {
|
||||
const processChildren = (children) => {
|
||||
children.forEach((child) => {
|
||||
if (child.type === 1) {
|
||||
processOption(child);
|
||||
} else if (child.type === 11) {
|
||||
processChildren(child.children);
|
||||
} else if (child.type === 9) {
|
||||
child.branches.forEach((b) => processChildren(b.children));
|
||||
}
|
||||
});
|
||||
};
|
||||
processChildren(node.children);
|
||||
processSelectChildren(node.children);
|
||||
} else {
|
||||
context.onError(
|
||||
compilerDom.createDOMCompilerError(
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/compiler-dom": "3.5.14"
|
||||
"@vue/compiler-dom": "3.5.18",
|
||||
"@vue/shared": "3.5.18"
|
||||
}
|
||||
}
|
||||
+97
-4
@@ -4552,18 +4552,21 @@ function getAppRecordId(app, defaultId) {
|
||||
return id;
|
||||
}
|
||||
function createAppRecord(app, types) {
|
||||
var _a25, _b25;
|
||||
const rootInstance = getAppRootInstance(app);
|
||||
if (rootInstance) {
|
||||
appRecordInfo.id++;
|
||||
const name = getAppRecordName(app, appRecordInfo.id.toString());
|
||||
const id = getAppRecordId(app, (0, import_speakingurl.default)(name));
|
||||
const [el] = getRootElementsFromComponentInstance(rootInstance);
|
||||
const record = {
|
||||
id,
|
||||
name,
|
||||
types,
|
||||
instanceMap: /* @__PURE__ */ new Map(),
|
||||
perfGroupIds: /* @__PURE__ */ new Map(),
|
||||
rootInstance
|
||||
rootInstance,
|
||||
iframe: import_devtools_shared20.isBrowser && document !== (el == null ? void 0 : el.ownerDocument) ? (_b25 = (_a25 = el == null ? void 0 : el.ownerDocument) == null ? void 0 : _a25.location) == null ? void 0 : _b25.pathname : void 0
|
||||
};
|
||||
app.__VUE_DEVTOOLS_NEXT_APP_RECORD__ = record;
|
||||
const rootId = `${record.id}:root`;
|
||||
@@ -4575,9 +4578,96 @@ function createAppRecord(app, types) {
|
||||
}
|
||||
}
|
||||
|
||||
// src/core/iframe/index.ts
|
||||
init_cjs_shims();
|
||||
function detectIframeApp(target22, inIframe = false) {
|
||||
if (inIframe) {
|
||||
let sendEventToParent2 = function(cb) {
|
||||
try {
|
||||
const hook3 = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (hook3) {
|
||||
cb(hook3);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
var sendEventToParent = sendEventToParent2;
|
||||
const hook2 = {
|
||||
id: "vue-devtools-next",
|
||||
devtoolsVersion: "7.0",
|
||||
on: (event, cb) => {
|
||||
sendEventToParent2((hook3) => {
|
||||
hook3.on(event, cb);
|
||||
});
|
||||
},
|
||||
once: (event, cb) => {
|
||||
sendEventToParent2((hook3) => {
|
||||
hook3.once(event, cb);
|
||||
});
|
||||
},
|
||||
off: (event, cb) => {
|
||||
sendEventToParent2((hook3) => {
|
||||
hook3.off(event, cb);
|
||||
});
|
||||
},
|
||||
emit: (event, ...payload) => {
|
||||
sendEventToParent2((hook3) => {
|
||||
hook3.emit(event, ...payload);
|
||||
});
|
||||
}
|
||||
};
|
||||
Object.defineProperty(target22, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
|
||||
get() {
|
||||
return hook2;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function injectVueHookToIframe(iframe) {
|
||||
if (iframe.__vdevtools__injected) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
iframe.__vdevtools__injected = true;
|
||||
const inject = () => {
|
||||
try {
|
||||
iframe.contentWindow.__VUE_DEVTOOLS_IFRAME__ = iframe;
|
||||
const script = iframe.contentDocument.createElement("script");
|
||||
script.textContent = `;(${detectIframeApp.toString()})(window, true)`;
|
||||
iframe.contentDocument.documentElement.appendChild(script);
|
||||
script.parentNode.removeChild(script);
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
inject();
|
||||
iframe.addEventListener("load", () => inject());
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
function injectVueHookToIframes() {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
const iframes = Array.from(document.querySelectorAll("iframe:not([data-vue-devtools-ignore])"));
|
||||
for (const iframe of iframes) {
|
||||
injectVueHookToIframe(iframe);
|
||||
}
|
||||
}
|
||||
injectVueHookToIframes();
|
||||
let iframeAppChecks = 0;
|
||||
const iframeAppCheckTimer = setInterval(() => {
|
||||
injectVueHookToIframes();
|
||||
iframeAppChecks++;
|
||||
if (iframeAppChecks >= 5) {
|
||||
clearInterval(iframeAppCheckTimer);
|
||||
}
|
||||
}, 1e3);
|
||||
}
|
||||
|
||||
// src/core/index.ts
|
||||
function initDevTools() {
|
||||
var _a25;
|
||||
detectIframeApp(import_devtools_shared21.target);
|
||||
updateDevToolsState({
|
||||
vitePluginDetected: getDevToolsEnv().vitePluginDetected
|
||||
});
|
||||
@@ -4597,8 +4687,10 @@ function initDevTools() {
|
||||
import_devtools_shared21.target.__VUE_DEVTOOLS_VUE2_APP_DETECTED__ = true;
|
||||
console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
|
||||
console.log("%cVue DevTools v7 detected in your Vue2 project. v7 only supports Vue3 and will not work.", "font-bold: 500; font-size: 14px;");
|
||||
const url = "https://chromewebstore.google.com/detail/vuejs-devtools/iaajmlceplecbljialhhkmedjlpdblhp";
|
||||
console.log(`%cThe legacy version that supports both Vue 2 and Vue 3 has been moved to %c ${url}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
|
||||
const legacyChromeUrl = "https://chromewebstore.google.com/detail/vuejs-devtools/iaajmlceplecbljialhhkmedjlpdblhp";
|
||||
const legacyFirefoxUrl = "https://addons.mozilla.org/firefox/addon/vue-js-devtools-v6-legacy";
|
||||
console.log(`%cThe legacy version of chrome extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyChromeUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
|
||||
console.log(`%cThe legacy version of firefox extension that supports both Vue 2 and Vue 3 has been moved to %c ${legacyFirefoxUrl}`, "font-size: 14px;", "text-decoration: underline; cursor: pointer;font-size: 14px;");
|
||||
console.log("%cPlease install and enable only the legacy version for your Vue2 app.", "font-bold: 500; font-size: 14px;");
|
||||
console.log("%c[_____Vue DevTools v7 log_____]", "color: red; font-bold: 600; font-size: 16px;");
|
||||
});
|
||||
@@ -4660,7 +4752,8 @@ function initDevTools() {
|
||||
Object.defineProperty(import_devtools_shared21.target, "__VUE_DEVTOOLS_GLOBAL_HOOK__", {
|
||||
get() {
|
||||
return _devtoolsHook;
|
||||
}
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
if (!import_devtools_shared21.isNuxtApp) {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@vue/devtools-kit",
|
||||
"type": "module",
|
||||
"version": "7.7.6",
|
||||
"version": "7.7.7",
|
||||
"author": "webfansplz",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"perfect-debounce": "^1.0.0",
|
||||
"speakingurl": "^14.0.1",
|
||||
"superjson": "^2.2.2",
|
||||
"@vue/devtools-shared": "^7.7.6"
|
||||
"@vue/devtools-shared": "^7.7.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/speakingurl": "^13.0.6",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@vue/devtools-shared",
|
||||
"type": "module",
|
||||
"version": "7.7.6",
|
||||
"version": "7.7.7",
|
||||
"author": "webfansplz",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+7
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/reactivity v3.5.14
|
||||
* @vue/reactivity v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -491,6 +491,7 @@ class Link {
|
||||
}
|
||||
}
|
||||
class Dep {
|
||||
// TODO isolatedDeclarations "__v_skip"
|
||||
constructor(computed) {
|
||||
this.computed = computed;
|
||||
this.version = 0;
|
||||
@@ -511,6 +512,10 @@ class Dep {
|
||||
* Subscriber counter
|
||||
*/
|
||||
this.sc = 0;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
this.__v_skip = true;
|
||||
}
|
||||
track(debugInfo) {
|
||||
if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
||||
@@ -1670,11 +1675,11 @@ function watch(source, cb, options = shared.EMPTY_OBJ) {
|
||||
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
||||
boundCleanup
|
||||
];
|
||||
oldValue = newValue;
|
||||
call ? call(cb, 3, args) : (
|
||||
// @ts-expect-error
|
||||
cb(...args)
|
||||
);
|
||||
oldValue = newValue;
|
||||
} finally {
|
||||
activeWatcher = currentWatcher;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/reactivity",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/reactivity",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
@@ -50,6 +50,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14"
|
||||
"@vue/shared": "3.5.18"
|
||||
}
|
||||
}
|
||||
+39
-17
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/runtime-core v3.5.14
|
||||
* @vue/runtime-core v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -449,15 +449,16 @@ const TeleportImpl = {
|
||||
updateCssVars(n2, true);
|
||||
}
|
||||
if (isTeleportDeferred(n2.props)) {
|
||||
n2.el.__isMounted = false;
|
||||
queuePostRenderEffect(() => {
|
||||
mountToTarget();
|
||||
n2.el.__isMounted = true;
|
||||
delete n2.el.__isMounted;
|
||||
}, parentSuspense);
|
||||
} else {
|
||||
mountToTarget();
|
||||
}
|
||||
} else {
|
||||
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
|
||||
if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
|
||||
queuePostRenderEffect(() => {
|
||||
TeleportImpl.process(
|
||||
n1,
|
||||
@@ -471,7 +472,6 @@ const TeleportImpl = {
|
||||
optimized,
|
||||
internals
|
||||
);
|
||||
delete n1.el.__isMounted;
|
||||
}, parentSuspense);
|
||||
return;
|
||||
}
|
||||
@@ -1390,6 +1390,8 @@ function createHydrationFunctions(rendererInternals) {
|
||||
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
||||
const content = el.content.firstChild;
|
||||
if (needCallTransitionHooks) {
|
||||
const cls = content.getAttribute("class");
|
||||
if (cls) content.$cls = cls;
|
||||
transition.beforeEnter(content);
|
||||
}
|
||||
replaceNode(content, el, parentComponent);
|
||||
@@ -1630,7 +1632,7 @@ function isMismatchAllowed(el, allowedType) {
|
||||
if (allowedType === 0 /* TEXT */ && list.includes("children")) {
|
||||
return true;
|
||||
}
|
||||
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
|
||||
return list.includes(MismatchTypeString[allowedType]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1779,15 +1781,23 @@ function defineAsyncComponent(source) {
|
||||
name: "AsyncComponentWrapper",
|
||||
__asyncLoader: load,
|
||||
__asyncHydrate(el, instance, hydrate) {
|
||||
let patched = false;
|
||||
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
||||
const performHydrate = () => {
|
||||
if (patched) {
|
||||
return;
|
||||
}
|
||||
hydrate();
|
||||
};
|
||||
const doHydrate = hydrateStrategy ? () => {
|
||||
const teardown = hydrateStrategy(
|
||||
hydrate,
|
||||
performHydrate,
|
||||
(cb) => forEachElement(el, cb)
|
||||
);
|
||||
if (teardown) {
|
||||
(instance.bum || (instance.bum = [])).push(teardown);
|
||||
}
|
||||
} : hydrate;
|
||||
} : performHydrate;
|
||||
if (resolvedComp) {
|
||||
doHydrate();
|
||||
} else {
|
||||
@@ -2500,7 +2510,7 @@ function useSlots() {
|
||||
function useAttrs() {
|
||||
return getContext().attrs;
|
||||
}
|
||||
function getContext() {
|
||||
function getContext(calledFunctionName) {
|
||||
const i = getCurrentInstance();
|
||||
return i.setupContext || (i.setupContext = createSetupContext(i));
|
||||
}
|
||||
@@ -2679,7 +2689,8 @@ function applyOptions(instance) {
|
||||
expose.forEach((key) => {
|
||||
Object.defineProperty(exposed, key, {
|
||||
get: () => publicThis[key],
|
||||
set: (val) => publicThis[key] = val
|
||||
set: (val) => publicThis[key] = val,
|
||||
enumerable: true
|
||||
});
|
||||
});
|
||||
} else if (!instance.exposed) {
|
||||
@@ -3040,9 +3051,9 @@ function provide(key, value) {
|
||||
}
|
||||
}
|
||||
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
||||
const instance = currentInstance || currentRenderingInstance;
|
||||
const instance = getCurrentInstance();
|
||||
if (instance || currentApp) {
|
||||
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
||||
let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
||||
if (provides && key in provides) {
|
||||
return provides[key];
|
||||
} else if (arguments.length > 1) {
|
||||
@@ -3051,7 +3062,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
||||
}
|
||||
}
|
||||
function hasInjectionContext() {
|
||||
return !!(currentInstance || currentRenderingInstance || currentApp);
|
||||
return !!(getCurrentInstance() || currentApp);
|
||||
}
|
||||
|
||||
const internalObjectProto = {};
|
||||
@@ -3330,7 +3341,7 @@ function validatePropName(key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
||||
const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
|
||||
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
||||
const normalizeSlot = (key, rawSlot, ctx) => {
|
||||
if (rawSlot._n) {
|
||||
@@ -3370,6 +3381,8 @@ const assignSlots = (slots, children, optimized) => {
|
||||
const initSlots = (instance, children, optimized) => {
|
||||
const slots = instance.slots = createInternalObject();
|
||||
if (instance.vnode.shapeFlag & 32) {
|
||||
const cacheIndexes = children.__;
|
||||
if (cacheIndexes) shared.def(slots, "__", cacheIndexes, true);
|
||||
const type = children._;
|
||||
if (type) {
|
||||
assignSlots(slots, children, optimized);
|
||||
@@ -3531,6 +3544,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
||||
}
|
||||
if (ref != null && parentComponent) {
|
||||
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
||||
} else if (ref == null && n1 && n1.ref != null) {
|
||||
setRef(n1.ref, null, parentSuspense, n1, true);
|
||||
}
|
||||
};
|
||||
const processText = (n1, n2, container, anchor) => {
|
||||
@@ -3803,7 +3818,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
||||
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
|
||||
// which also requires the correct parent container
|
||||
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
|
||||
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
|
||||
oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
|
||||
// In other cases, the parent container is not actually used so we
|
||||
// just pass the block element here to avoid a DOM parentNode call.
|
||||
fallbackContainer
|
||||
@@ -3960,6 +3975,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
||||
if (!initialVNode.el) {
|
||||
const placeholder = instance.subTree = createVNode(Comment);
|
||||
processCommentNode(null, placeholder, container, anchor);
|
||||
initialVNode.placeholder = placeholder.el;
|
||||
}
|
||||
} else {
|
||||
setupRenderEffect(
|
||||
@@ -4024,7 +4040,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
||||
hydrateSubTree();
|
||||
}
|
||||
} else {
|
||||
if (root.ce) {
|
||||
if (root.ce && // @ts-expect-error _def is private
|
||||
root.ce._def.shadowRoot !== false) {
|
||||
root.ce._injectChildStyle(type);
|
||||
}
|
||||
const subTree = instance.subTree = renderComponentRoot(instance);
|
||||
@@ -4391,7 +4408,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
||||
for (i = toBePatched - 1; i >= 0; i--) {
|
||||
const nextIndex = s2 + i;
|
||||
const nextChild = c2[nextIndex];
|
||||
const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
||||
const anchorVNode = c2[nextIndex + 1];
|
||||
const anchor = nextIndex + 1 < l2 ? (
|
||||
// #13559, fallback to el placeholder for unresolved async component
|
||||
anchorVNode.el || anchorVNode.placeholder
|
||||
) : parentAnchor;
|
||||
if (newIndexToOldIndexMap[i] === 0) {
|
||||
patch(
|
||||
null,
|
||||
@@ -6050,6 +6071,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
||||
suspense: vnode.suspense,
|
||||
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
||||
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
||||
placeholder: vnode.placeholder,
|
||||
el: vnode.el,
|
||||
anchor: vnode.anchor,
|
||||
ctx: vnode.ctx,
|
||||
@@ -6515,7 +6537,7 @@ function isMemoSame(cached, memo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const version = "3.5.14";
|
||||
const version = "3.5.18";
|
||||
const warn$1 = shared.NOOP;
|
||||
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
||||
const devtools = void 0;
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/runtime-core",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/runtime-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
@@ -46,7 +46,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/reactivity": "3.5.14"
|
||||
"@vue/shared": "3.5.18",
|
||||
"@vue/reactivity": "3.5.18"
|
||||
}
|
||||
}
|
||||
+21
-15
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/runtime-dom v3.5.14
|
||||
* @vue/runtime-dom v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -786,13 +786,10 @@ class VueElement extends BaseClass {
|
||||
this._root = this;
|
||||
}
|
||||
}
|
||||
if (!this._def.__asyncLoader) {
|
||||
this._resolveProps(this._def);
|
||||
}
|
||||
}
|
||||
connectedCallback() {
|
||||
if (!this.isConnected) return;
|
||||
if (!this.shadowRoot) {
|
||||
if (!this.shadowRoot && !this._resolved) {
|
||||
this._parseSlots();
|
||||
}
|
||||
this._connected = true;
|
||||
@@ -805,8 +802,7 @@ class VueElement extends BaseClass {
|
||||
}
|
||||
if (!this._instance) {
|
||||
if (this._resolved) {
|
||||
this._setParent();
|
||||
this._update();
|
||||
this._mount(this._def);
|
||||
} else {
|
||||
if (parent && parent._pendingResolve) {
|
||||
this._pendingResolve = parent._pendingResolve.then(() => {
|
||||
@@ -822,7 +818,15 @@ class VueElement extends BaseClass {
|
||||
_setParent(parent = this._parent) {
|
||||
if (parent) {
|
||||
this._instance.parent = parent._instance;
|
||||
this._instance.provides = parent._instance.provides;
|
||||
this._inheritParentContext(parent);
|
||||
}
|
||||
}
|
||||
_inheritParentContext(parent = this._parent) {
|
||||
if (parent && this._app) {
|
||||
Object.setPrototypeOf(
|
||||
this._app._context.provides,
|
||||
parent._instance.provides
|
||||
);
|
||||
}
|
||||
}
|
||||
disconnectedCallback() {
|
||||
@@ -872,9 +876,7 @@ class VueElement extends BaseClass {
|
||||
}
|
||||
}
|
||||
this._numberProps = numberProps;
|
||||
if (isAsync) {
|
||||
this._resolveProps(def);
|
||||
}
|
||||
this._resolveProps(def);
|
||||
if (this.shadowRoot) {
|
||||
this._applyStyles(styles);
|
||||
}
|
||||
@@ -882,15 +884,17 @@ class VueElement extends BaseClass {
|
||||
};
|
||||
const asyncDef = this._def.__asyncLoader;
|
||||
if (asyncDef) {
|
||||
this._pendingResolve = asyncDef().then(
|
||||
(def) => resolve(this._def = def, true)
|
||||
);
|
||||
this._pendingResolve = asyncDef().then((def) => {
|
||||
def.configureApp = this._def.configureApp;
|
||||
resolve(this._def = def, true);
|
||||
});
|
||||
} else {
|
||||
resolve(this._def);
|
||||
}
|
||||
}
|
||||
_mount(def) {
|
||||
this._app = this._createApp(def);
|
||||
this._inheritParentContext();
|
||||
if (def.configureApp) {
|
||||
def.configureApp(this._app);
|
||||
}
|
||||
@@ -973,7 +977,9 @@ class VueElement extends BaseClass {
|
||||
}
|
||||
}
|
||||
_update() {
|
||||
render(this._createVNode(), this._root);
|
||||
const vnode = this._createVNode();
|
||||
if (this._app) vnode.appContext = this._app._context;
|
||||
render(vnode, this._root);
|
||||
}
|
||||
_createVNode() {
|
||||
const baseProps = {};
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/runtime-dom",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/runtime-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
@@ -50,9 +50,9 @@
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
||||
"dependencies": {
|
||||
"csstype": "^3.1.3",
|
||||
"@vue/runtime-core": "3.5.14",
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/reactivity": "3.5.14"
|
||||
"@vue/shared": "3.5.18",
|
||||
"@vue/runtime-core": "3.5.18",
|
||||
"@vue/reactivity": "3.5.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
|
||||
Generated
Vendored
+26
-4
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/server-renderer v3.5.14
|
||||
* @vue/server-renderer v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -78,9 +78,23 @@ function ssrRenderStyle(raw) {
|
||||
if (shared.isString(raw)) {
|
||||
return shared.escapeHtml(raw);
|
||||
}
|
||||
const styles = shared.normalizeStyle(raw);
|
||||
const styles = shared.normalizeStyle(ssrResetCssVars(raw));
|
||||
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||
}
|
||||
function ssrResetCssVars(raw) {
|
||||
if (!shared.isArray(raw) && shared.isObject(raw)) {
|
||||
const res = {};
|
||||
for (const key in raw) {
|
||||
if (key.startsWith(":--")) {
|
||||
res[key.slice(1)] = shared.normalizeCssVarValue(raw[key]);
|
||||
} else {
|
||||
res[key] = raw[key];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
||||
return renderComponentVNode(
|
||||
@@ -128,6 +142,8 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
||||
);
|
||||
} else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
} else {
|
||||
let isEmptySlot = true;
|
||||
@@ -152,13 +168,19 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
||||
start++;
|
||||
end--;
|
||||
}
|
||||
for (let i = start; i < end; i++) {
|
||||
push(slotBuffer[i]);
|
||||
if (start < end) {
|
||||
for (let i = start; i < end; i++) {
|
||||
push(slotBuffer[i]);
|
||||
}
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
const commentTestRE = /^<!--[\s\S]*-->$/;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/server-renderer",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "@vue/server-renderer",
|
||||
"main": "index.js",
|
||||
"module": "dist/server-renderer.esm-bundler.js",
|
||||
@@ -46,10 +46,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
||||
"peerDependencies": {
|
||||
"vue": "3.5.14"
|
||||
"vue": "3.5.18"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/compiler-ssr": "3.5.14"
|
||||
"@vue/shared": "3.5.18",
|
||||
"@vue/compiler-ssr": "3.5.18"
|
||||
}
|
||||
}
|
||||
+13
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @vue/shared v3.5.14
|
||||
* @vue/shared v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
@@ -164,7 +164,7 @@ const PatchFlagNames = {
|
||||
[512]: `NEED_PATCH`,
|
||||
[1024]: `DYNAMIC_SLOTS`,
|
||||
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1]: `HOISTED`,
|
||||
[-1]: `CACHED`,
|
||||
[-2]: `BAIL`
|
||||
};
|
||||
|
||||
@@ -520,6 +520,16 @@ const stringifySymbol = (v, i = "") => {
|
||||
);
|
||||
};
|
||||
|
||||
function normalizeCssVarValue(value) {
|
||||
if (value == null) {
|
||||
return "initial";
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return value === "" ? " " : value;
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
@@ -579,6 +589,7 @@ exports.looseIndexOf = looseIndexOf;
|
||||
exports.looseToNumber = looseToNumber;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeCssVarValue = normalizeCssVarValue;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ export default isFetchSupported && (async (config) => {
|
||||
credentials: isCredentialsSupported ? withCredentials : undefined
|
||||
});
|
||||
|
||||
let response = await fetch(request);
|
||||
let response = await fetch(request, fetchOptions);
|
||||
|
||||
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
||||
|
||||
|
||||
+2
-2
@@ -153,8 +153,8 @@ class Axios {
|
||||
|
||||
if (!synchronousRequestInterceptors) {
|
||||
const chain = [dispatchRequest.bind(this), undefined];
|
||||
chain.unshift.apply(chain, requestInterceptorChain);
|
||||
chain.push.apply(chain, responseInterceptorChain);
|
||||
chain.unshift(...requestInterceptorChain);
|
||||
chain.push(...responseInterceptorChain);
|
||||
len = chain.length;
|
||||
|
||||
promise = Promise.resolve(config);
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ export default function mergeConfig(config1, config2) {
|
||||
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
||||
};
|
||||
|
||||
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export const VERSION = "1.9.0";
|
||||
export const VERSION = "1.11.0";
|
||||
+1
-1
@@ -17,7 +17,7 @@ function throttle(fn, freq) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
fn.apply(null, args);
|
||||
fn(...args);
|
||||
}
|
||||
|
||||
const throttled = (...args) => {
|
||||
|
||||
+4
@@ -120,6 +120,10 @@ function toFormData(obj, formData, options) {
|
||||
return value.toISOString();
|
||||
}
|
||||
|
||||
if (utils.isBoolean(value)) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
if (!useBlob && utils.isBlob(value)) {
|
||||
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
||||
}
|
||||
|
||||
+4
-3
@@ -5,7 +5,7 @@ import toFormData from './toFormData.js';
|
||||
import platform from '../platform/index.js';
|
||||
|
||||
export default function toURLEncodedForm(data, options) {
|
||||
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
||||
return toFormData(data, new platform.classes.URLSearchParams(), {
|
||||
visitor: function(value, key, path, helpers) {
|
||||
if (platform.isNode && utils.isBuffer(value)) {
|
||||
this.append(key, value.toString('base64'));
|
||||
@@ -13,6 +13,7 @@ export default function toURLEncodedForm(data, options) {
|
||||
}
|
||||
|
||||
return helpers.defaultVisitor.apply(this, arguments);
|
||||
}
|
||||
}, options));
|
||||
},
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
+36
@@ -136,6 +136,27 @@ const isPlainObject = (val) => {
|
||||
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is an empty object (safely handles Buffers)
|
||||
*
|
||||
* @param {*} val The value to test
|
||||
*
|
||||
* @returns {boolean} True if value is an empty object, otherwise false
|
||||
*/
|
||||
const isEmptyObject = (val) => {
|
||||
// Early return for non-objects or Buffers to prevent RangeError
|
||||
if (!isObject(val) || isBuffer(val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
||||
} catch (e) {
|
||||
// Fallback for any other objects that might cause RangeError with Object.keys()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is a Date
|
||||
*
|
||||
@@ -258,6 +279,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
}
|
||||
} else {
|
||||
// Buffer check
|
||||
if (isBuffer(obj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate over object keys
|
||||
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
||||
const len = keys.length;
|
||||
@@ -271,6 +297,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
}
|
||||
|
||||
function findKey(obj, key) {
|
||||
if (isBuffer(obj)){
|
||||
return null;
|
||||
}
|
||||
|
||||
key = key.toLowerCase();
|
||||
const keys = Object.keys(obj);
|
||||
let i = keys.length;
|
||||
@@ -624,6 +654,11 @@ const toJSONObject = (obj) => {
|
||||
return;
|
||||
}
|
||||
|
||||
//Buffer check
|
||||
if (isBuffer(source)) {
|
||||
return source;
|
||||
}
|
||||
|
||||
if(!('toJSON' in source)) {
|
||||
stack[i] = source;
|
||||
const target = isArray(source) ? [] : {};
|
||||
@@ -695,6 +730,7 @@ export default {
|
||||
isBoolean,
|
||||
isObject,
|
||||
isPlainObject,
|
||||
isEmptyObject,
|
||||
isReadableStream,
|
||||
isRequest,
|
||||
isResponse,
|
||||
|
||||
+14
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "1.9.0",
|
||||
"version": "1.11.0",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -9,6 +9,10 @@
|
||||
"require": "./index.d.cts",
|
||||
"default": "./index.d.ts"
|
||||
},
|
||||
"react-native": {
|
||||
"require": "./dist/browser/axios.cjs",
|
||||
"default": "./dist/esm/axios.js"
|
||||
},
|
||||
"browser": {
|
||||
"require": "./dist/browser/axios.cjs",
|
||||
"default": "./index.js"
|
||||
@@ -143,12 +147,17 @@
|
||||
"./lib/platform/node/index.js": "./lib/platform/browser/index.js",
|
||||
"./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js"
|
||||
},
|
||||
"react-native": {
|
||||
"./lib/adapters/http.js": "./lib/helpers/null.js",
|
||||
"./lib/platform/node/index.js": "./lib/platform/browser/index.js",
|
||||
"./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js"
|
||||
},
|
||||
"jsdelivr": "dist/axios.min.js",
|
||||
"unpkg": "dist/axios.min.js",
|
||||
"typings": "./index.d.ts",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
},
|
||||
"bundlesize": [
|
||||
@@ -167,10 +176,10 @@
|
||||
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
||||
"Martti Laine (https://github.com/codeclown)",
|
||||
"Xianming Zhong (https://github.com/chinesedfan)",
|
||||
"Rikki Gibson (https://github.com/RikkiGibson)",
|
||||
"Remco Haszing (https://github.com/remcohaszing)",
|
||||
"Yasu Flores (https://github.com/yasuf)",
|
||||
"Ben Carp (https://github.com/carpben)"
|
||||
"Rikki Gibson (https://github.com/RikkiGibson)",
|
||||
"Ben Carp (https://github.com/carpben)",
|
||||
"Yasu Flores (https://github.com/yasuf)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"release-it": {
|
||||
|
||||
+23
-2
@@ -31,6 +31,11 @@ function createBirpc(functions, options) {
|
||||
return functions;
|
||||
if (method === "$close")
|
||||
return close;
|
||||
if (method === "$rejectPendingCalls") {
|
||||
return rejectPendingCalls;
|
||||
}
|
||||
if (method === "$closed")
|
||||
return closed;
|
||||
if (method === "then" && !eventNames.includes("then") && !("then" in functions))
|
||||
return void 0;
|
||||
const sendEvent = (...args) => {
|
||||
@@ -75,14 +80,30 @@ function createBirpc(functions, options) {
|
||||
return sendCall;
|
||||
}
|
||||
});
|
||||
function close(error) {
|
||||
function close(customError) {
|
||||
closed = true;
|
||||
rpcPromiseMap.forEach(({ reject, method }) => {
|
||||
reject(error || new Error(`[birpc] rpc is closed, cannot call "${method}"`));
|
||||
const error = new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
||||
if (customError) {
|
||||
customError.cause ??= error;
|
||||
return reject(customError);
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
rpcPromiseMap.clear();
|
||||
off(onMessage);
|
||||
}
|
||||
function rejectPendingCalls(handler) {
|
||||
const entries = Array.from(rpcPromiseMap.values());
|
||||
const handlerResults = entries.map(({ method, reject }) => {
|
||||
if (!handler) {
|
||||
return reject(new Error(`[birpc]: rejected pending call "${method}".`));
|
||||
}
|
||||
return handler({ method, reject });
|
||||
});
|
||||
rpcPromiseMap.clear();
|
||||
return handlerResults;
|
||||
}
|
||||
async function onMessage(data, ...extra) {
|
||||
let msg;
|
||||
try {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "birpc",
|
||||
"type": "module",
|
||||
"version": "2.3.0",
|
||||
"version": "2.5.0",
|
||||
"description": "Message based Two-way remote procedure call",
|
||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "css-select",
|
||||
"version": "5.1.0",
|
||||
"version": "5.2.2",
|
||||
"description": "a CSS selector compiler/engine",
|
||||
"author": "Felix Boehm <me@feedic.com>",
|
||||
"funding": {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"author": "Felix Böhm <me@feedic.com> (http://feedic.com)",
|
||||
"name": "css-what",
|
||||
"description": "a CSS selector parser",
|
||||
"version": "6.1.0",
|
||||
"version": "6.2.2",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
},
|
||||
|
||||
+126
-135
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var CombinedStream = require('combined-stream');
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
@@ -6,24 +8,20 @@ var https = require('https');
|
||||
var parseUrl = require('url').parse;
|
||||
var fs = require('fs');
|
||||
var Stream = require('stream').Stream;
|
||||
var crypto = require('crypto');
|
||||
var mime = require('mime-types');
|
||||
var asynckit = require('asynckit');
|
||||
var setToStringTag = require('es-set-tostringtag');
|
||||
var hasOwn = require('hasown');
|
||||
var populate = require('./populate.js');
|
||||
|
||||
// Public API
|
||||
module.exports = FormData;
|
||||
|
||||
// make it a Stream
|
||||
util.inherits(FormData, CombinedStream);
|
||||
|
||||
/**
|
||||
* Create readable "multipart/form-data" streams.
|
||||
* Can be used to submit forms
|
||||
* and file uploads to other web applications.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
||||
* @param {object} options - Properties to be added/overriden for FormData and CombinedStream
|
||||
*/
|
||||
function FormData(options) {
|
||||
if (!(this instanceof FormData)) {
|
||||
@@ -36,35 +34,39 @@ function FormData(options) {
|
||||
|
||||
CombinedStream.call(this);
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
options = options || {}; // eslint-disable-line no-param-reassign
|
||||
for (var option in options) { // eslint-disable-line no-restricted-syntax
|
||||
this[option] = options[option];
|
||||
}
|
||||
}
|
||||
|
||||
// make it a Stream
|
||||
util.inherits(FormData, CombinedStream);
|
||||
|
||||
FormData.LINE_BREAK = '\r\n';
|
||||
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
||||
|
||||
FormData.prototype.append = function(field, value, options) {
|
||||
|
||||
options = options || {};
|
||||
FormData.prototype.append = function (field, value, options) {
|
||||
options = options || {}; // eslint-disable-line no-param-reassign
|
||||
|
||||
// allow filename as single option
|
||||
if (typeof options == 'string') {
|
||||
options = {filename: options};
|
||||
if (typeof options === 'string') {
|
||||
options = { filename: options }; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
var append = CombinedStream.prototype.append.bind(this);
|
||||
|
||||
// all that streamy business can't handle numbers
|
||||
if (typeof value == 'number') {
|
||||
value = '' + value;
|
||||
if (typeof value === 'number' || value == null) {
|
||||
value = String(value); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
// https://github.com/felixge/node-form-data/issues/38
|
||||
if (Array.isArray(value)) {
|
||||
// Please convert your array into string
|
||||
// the way web server expects it
|
||||
/*
|
||||
* Please convert your array into string
|
||||
* the way web server expects it
|
||||
*/
|
||||
this._error(new Error('Arrays are not supported.'));
|
||||
return;
|
||||
}
|
||||
@@ -80,15 +82,17 @@ FormData.prototype.append = function(field, value, options) {
|
||||
this._trackLength(header, value, options);
|
||||
};
|
||||
|
||||
FormData.prototype._trackLength = function(header, value, options) {
|
||||
FormData.prototype._trackLength = function (header, value, options) {
|
||||
var valueLength = 0;
|
||||
|
||||
// used w/ getLengthSync(), when length is known.
|
||||
// e.g. for streaming directly from a remote server,
|
||||
// w/ a known file a size, and not wanting to wait for
|
||||
// incoming file to finish to get its size.
|
||||
/*
|
||||
* used w/ getLengthSync(), when length is known.
|
||||
* e.g. for streaming directly from a remote server,
|
||||
* w/ a known file a size, and not wanting to wait for
|
||||
* incoming file to finish to get its size.
|
||||
*/
|
||||
if (options.knownLength != null) {
|
||||
valueLength += +options.knownLength;
|
||||
valueLength += Number(options.knownLength);
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
valueLength = value.length;
|
||||
} else if (typeof value === 'string') {
|
||||
@@ -98,12 +102,10 @@ FormData.prototype._trackLength = function(header, value, options) {
|
||||
this._valueLength += valueLength;
|
||||
|
||||
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
||||
this._overheadLength +=
|
||||
Buffer.byteLength(header) +
|
||||
FormData.LINE_BREAK.length;
|
||||
this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length;
|
||||
|
||||
// empty or either doesn't have path or not an http response or not a stream
|
||||
if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream))) {
|
||||
if (!value || (!value.path && !(value.readable && hasOwn(value, 'httpVersion')) && !(value instanceof Stream))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,9 +115,8 @@ FormData.prototype._trackLength = function(header, value, options) {
|
||||
}
|
||||
};
|
||||
|
||||
FormData.prototype._lengthRetriever = function(value, callback) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
|
||||
|
||||
FormData.prototype._lengthRetriever = function (value, callback) {
|
||||
if (hasOwn(value, 'fd')) {
|
||||
// take read range into a account
|
||||
// `end` = Infinity –> read file till the end
|
||||
//
|
||||
@@ -124,54 +125,52 @@ FormData.prototype._lengthRetriever = function(value, callback) {
|
||||
// Fix it when node fixes it.
|
||||
// https://github.com/joyent/node/issues/7819
|
||||
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
||||
|
||||
// when end specified
|
||||
// no need to calculate range
|
||||
// inclusive, starts with 0
|
||||
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
||||
callback(null, value.end + 1 - (value.start ? value.start : 0)); // eslint-disable-line callback-return
|
||||
|
||||
// not that fast snoopy
|
||||
// not that fast snoopy
|
||||
} else {
|
||||
// still need to fetch file size from fs
|
||||
fs.stat(value.path, function(err, stat) {
|
||||
|
||||
var fileSize;
|
||||
|
||||
fs.stat(value.path, function (err, stat) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// update final size based on the range options
|
||||
fileSize = stat.size - (value.start ? value.start : 0);
|
||||
var fileSize = stat.size - (value.start ? value.start : 0);
|
||||
callback(null, fileSize);
|
||||
});
|
||||
}
|
||||
|
||||
// or http response
|
||||
} else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
||||
callback(null, +value.headers['content-length']);
|
||||
// or http response
|
||||
} else if (hasOwn(value, 'httpVersion')) {
|
||||
callback(null, Number(value.headers['content-length'])); // eslint-disable-line callback-return
|
||||
|
||||
// or request stream http://github.com/mikeal/request
|
||||
} else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
|
||||
// or request stream http://github.com/mikeal/request
|
||||
} else if (hasOwn(value, 'httpModule')) {
|
||||
// wait till response come back
|
||||
value.on('response', function(response) {
|
||||
value.on('response', function (response) {
|
||||
value.pause();
|
||||
callback(null, +response.headers['content-length']);
|
||||
callback(null, Number(response.headers['content-length']));
|
||||
});
|
||||
value.resume();
|
||||
|
||||
// something else
|
||||
// something else
|
||||
} else {
|
||||
callback('Unknown stream');
|
||||
callback('Unknown stream'); // eslint-disable-line callback-return
|
||||
}
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
// custom header specified (as string)?
|
||||
// it becomes responsible for boundary
|
||||
// (e.g. to handle extra CRLFs on .NET servers)
|
||||
if (typeof options.header == 'string') {
|
||||
FormData.prototype._multiPartHeader = function (field, value, options) {
|
||||
/*
|
||||
* custom header specified (as string)?
|
||||
* it becomes responsible for boundary
|
||||
* (e.g. to handle extra CRLFs on .NET servers)
|
||||
*/
|
||||
if (typeof options.header === 'string') {
|
||||
return options.header;
|
||||
}
|
||||
|
||||
@@ -179,7 +178,7 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
var contentType = this._getContentType(value, options);
|
||||
|
||||
var contents = '';
|
||||
var headers = {
|
||||
var headers = {
|
||||
// add custom disposition as third element or keep it two elements if not
|
||||
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
||||
// if no content type. allow it to be empty array
|
||||
@@ -187,18 +186,18 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
};
|
||||
|
||||
// allow custom headers.
|
||||
if (typeof options.header == 'object') {
|
||||
if (typeof options.header === 'object') {
|
||||
populate(headers, options.header);
|
||||
}
|
||||
|
||||
var header;
|
||||
for (var prop in headers) {
|
||||
if (Object.prototype.hasOwnProperty.call(headers, prop)) {
|
||||
for (var prop in headers) { // eslint-disable-line no-restricted-syntax
|
||||
if (hasOwn(headers, prop)) {
|
||||
header = headers[prop];
|
||||
|
||||
// skip nullish headers.
|
||||
if (header == null) {
|
||||
continue;
|
||||
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
||||
}
|
||||
|
||||
// convert all headers to arrays.
|
||||
@@ -216,49 +215,45 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
|
||||
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
||||
};
|
||||
|
||||
FormData.prototype._getContentDisposition = function(value, options) {
|
||||
|
||||
var filename
|
||||
, contentDisposition
|
||||
;
|
||||
FormData.prototype._getContentDisposition = function (value, options) { // eslint-disable-line consistent-return
|
||||
var filename;
|
||||
|
||||
if (typeof options.filepath === 'string') {
|
||||
// custom filepath for relative paths
|
||||
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
||||
} else if (options.filename || value.name || value.path) {
|
||||
// custom filename take precedence
|
||||
// formidable and the browser add a name property
|
||||
// fs- and request- streams have path property
|
||||
filename = path.basename(options.filename || value.name || value.path);
|
||||
} else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
||||
} else if (options.filename || (value && (value.name || value.path))) {
|
||||
/*
|
||||
* custom filename take precedence
|
||||
* formidable and the browser add a name property
|
||||
* fs- and request- streams have path property
|
||||
*/
|
||||
filename = path.basename(options.filename || (value && (value.name || value.path)));
|
||||
} else if (value && value.readable && hasOwn(value, 'httpVersion')) {
|
||||
// or try http response
|
||||
filename = path.basename(value.client._httpMessage.path || '');
|
||||
}
|
||||
|
||||
if (filename) {
|
||||
contentDisposition = 'filename="' + filename + '"';
|
||||
return 'filename="' + filename + '"';
|
||||
}
|
||||
|
||||
return contentDisposition;
|
||||
};
|
||||
|
||||
FormData.prototype._getContentType = function(value, options) {
|
||||
|
||||
FormData.prototype._getContentType = function (value, options) {
|
||||
// use custom content-type above all
|
||||
var contentType = options.contentType;
|
||||
|
||||
// or try `name` from formidable, browser
|
||||
if (!contentType && value.name) {
|
||||
if (!contentType && value && value.name) {
|
||||
contentType = mime.lookup(value.name);
|
||||
}
|
||||
|
||||
// or try `path` from fs-, request- streams
|
||||
if (!contentType && value.path) {
|
||||
if (!contentType && value && value.path) {
|
||||
contentType = mime.lookup(value.path);
|
||||
}
|
||||
|
||||
// or if it's http-reponse
|
||||
if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
||||
if (!contentType && value && value.readable && hasOwn(value, 'httpVersion')) {
|
||||
contentType = value.headers['content-type'];
|
||||
}
|
||||
|
||||
@@ -268,18 +263,18 @@ FormData.prototype._getContentType = function(value, options) {
|
||||
}
|
||||
|
||||
// fallback to the default content type if `value` is not simple value
|
||||
if (!contentType && typeof value == 'object') {
|
||||
if (!contentType && value && typeof value === 'object') {
|
||||
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
||||
}
|
||||
|
||||
return contentType;
|
||||
};
|
||||
|
||||
FormData.prototype._multiPartFooter = function() {
|
||||
return function(next) {
|
||||
FormData.prototype._multiPartFooter = function () {
|
||||
return function (next) {
|
||||
var footer = FormData.LINE_BREAK;
|
||||
|
||||
var lastPart = (this._streams.length === 0);
|
||||
var lastPart = this._streams.length === 0;
|
||||
if (lastPart) {
|
||||
footer += this._lastBoundary();
|
||||
}
|
||||
@@ -288,18 +283,18 @@ FormData.prototype._multiPartFooter = function() {
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
FormData.prototype._lastBoundary = function() {
|
||||
FormData.prototype._lastBoundary = function () {
|
||||
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
||||
};
|
||||
|
||||
FormData.prototype.getHeaders = function(userHeaders) {
|
||||
FormData.prototype.getHeaders = function (userHeaders) {
|
||||
var header;
|
||||
var formHeaders = {
|
||||
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
||||
};
|
||||
|
||||
for (header in userHeaders) {
|
||||
if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
|
||||
for (header in userHeaders) { // eslint-disable-line no-restricted-syntax
|
||||
if (hasOwn(userHeaders, header)) {
|
||||
formHeaders[header.toLowerCase()] = userHeaders[header];
|
||||
}
|
||||
}
|
||||
@@ -307,11 +302,14 @@ FormData.prototype.getHeaders = function(userHeaders) {
|
||||
return formHeaders;
|
||||
};
|
||||
|
||||
FormData.prototype.setBoundary = function(boundary) {
|
||||
FormData.prototype.setBoundary = function (boundary) {
|
||||
if (typeof boundary !== 'string') {
|
||||
throw new TypeError('FormData boundary must be a string');
|
||||
}
|
||||
this._boundary = boundary;
|
||||
};
|
||||
|
||||
FormData.prototype.getBoundary = function() {
|
||||
FormData.prototype.getBoundary = function () {
|
||||
if (!this._boundary) {
|
||||
this._generateBoundary();
|
||||
}
|
||||
@@ -319,60 +317,55 @@ FormData.prototype.getBoundary = function() {
|
||||
return this._boundary;
|
||||
};
|
||||
|
||||
FormData.prototype.getBuffer = function() {
|
||||
var dataBuffer = new Buffer.alloc(0);
|
||||
FormData.prototype.getBuffer = function () {
|
||||
var dataBuffer = new Buffer.alloc(0); // eslint-disable-line new-cap
|
||||
var boundary = this.getBoundary();
|
||||
|
||||
// Create the form content. Add Line breaks to the end of data.
|
||||
for (var i = 0, len = this._streams.length; i < len; i++) {
|
||||
if (typeof this._streams[i] !== 'function') {
|
||||
|
||||
// Add content to the buffer.
|
||||
if(Buffer.isBuffer(this._streams[i])) {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
|
||||
}else {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
|
||||
if (Buffer.isBuffer(this._streams[i])) {
|
||||
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
||||
} else {
|
||||
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
||||
}
|
||||
|
||||
// Add break after content.
|
||||
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
|
||||
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
|
||||
if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
||||
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the footer and return the Buffer object.
|
||||
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
|
||||
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
||||
};
|
||||
|
||||
FormData.prototype._generateBoundary = function() {
|
||||
FormData.prototype._generateBoundary = function () {
|
||||
// This generates a 50 character boundary similar to those used by Firefox.
|
||||
// They are optimized for boyer-moore parsing.
|
||||
var boundary = '--------------------------';
|
||||
for (var i = 0; i < 24; i++) {
|
||||
boundary += Math.floor(Math.random() * 10).toString(16);
|
||||
}
|
||||
|
||||
this._boundary = boundary;
|
||||
// They are optimized for boyer-moore parsing.
|
||||
this._boundary = '--------------------------' + crypto.randomBytes(12).toString('hex');
|
||||
};
|
||||
|
||||
// Note: getLengthSync DOESN'T calculate streams length
|
||||
// As workaround one can calculate file size manually
|
||||
// and add it as knownLength option
|
||||
FormData.prototype.getLengthSync = function() {
|
||||
// As workaround one can calculate file size manually and add it as knownLength option
|
||||
FormData.prototype.getLengthSync = function () {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
||||
// so it basically checks if there is any value added to the form
|
||||
// Don't get confused, there are 3 "internal" streams for each keyval pair so it basically checks if there is any value added to the form
|
||||
if (this._streams.length) {
|
||||
knownLength += this._lastBoundary().length;
|
||||
}
|
||||
|
||||
// https://github.com/form-data/form-data/issues/40
|
||||
if (!this.hasKnownLength()) {
|
||||
// Some async length retrievers are present
|
||||
// therefore synchronous length calculation is false.
|
||||
// Please use getLength(callback) to get proper length
|
||||
/*
|
||||
* Some async length retrievers are present
|
||||
* therefore synchronous length calculation is false.
|
||||
* Please use getLength(callback) to get proper length
|
||||
*/
|
||||
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
||||
}
|
||||
|
||||
@@ -382,7 +375,7 @@ FormData.prototype.getLengthSync = function() {
|
||||
// Public API to check if length of added values is known
|
||||
// https://github.com/form-data/form-data/issues/196
|
||||
// https://github.com/form-data/form-data/issues/262
|
||||
FormData.prototype.hasKnownLength = function() {
|
||||
FormData.prototype.hasKnownLength = function () {
|
||||
var hasKnownLength = true;
|
||||
|
||||
if (this._valuesToMeasure.length) {
|
||||
@@ -392,7 +385,7 @@ FormData.prototype.hasKnownLength = function() {
|
||||
return hasKnownLength;
|
||||
};
|
||||
|
||||
FormData.prototype.getLength = function(cb) {
|
||||
FormData.prototype.getLength = function (cb) {
|
||||
var knownLength = this._overheadLength + this._valueLength;
|
||||
|
||||
if (this._streams.length) {
|
||||
@@ -404,13 +397,13 @@ FormData.prototype.getLength = function(cb) {
|
||||
return;
|
||||
}
|
||||
|
||||
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
||||
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function (err, values) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
values.forEach(function(length) {
|
||||
values.forEach(function (length) {
|
||||
knownLength += length;
|
||||
});
|
||||
|
||||
@@ -418,31 +411,26 @@ FormData.prototype.getLength = function(cb) {
|
||||
});
|
||||
};
|
||||
|
||||
FormData.prototype.submit = function(params, cb) {
|
||||
var request
|
||||
, options
|
||||
, defaults = {method: 'post'}
|
||||
;
|
||||
FormData.prototype.submit = function (params, cb) {
|
||||
var request;
|
||||
var options;
|
||||
var defaults = { method: 'post' };
|
||||
|
||||
// parse provided url if it's string
|
||||
// or treat it as options object
|
||||
if (typeof params == 'string') {
|
||||
|
||||
params = parseUrl(params);
|
||||
// parse provided url if it's string or treat it as options object
|
||||
if (typeof params === 'string') {
|
||||
params = parseUrl(params); // eslint-disable-line no-param-reassign
|
||||
/* eslint sort-keys: 0 */
|
||||
options = populate({
|
||||
port: params.port,
|
||||
path: params.pathname,
|
||||
host: params.hostname,
|
||||
protocol: params.protocol
|
||||
}, defaults);
|
||||
|
||||
// use custom params
|
||||
} else {
|
||||
|
||||
} else { // use custom params
|
||||
options = populate(params, defaults);
|
||||
// if no port provided use default one
|
||||
if (!options.port) {
|
||||
options.port = options.protocol == 'https:' ? 443 : 80;
|
||||
options.port = options.protocol === 'https:' ? 443 : 80;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,14 +438,14 @@ FormData.prototype.submit = function(params, cb) {
|
||||
options.headers = this.getHeaders(params.headers);
|
||||
|
||||
// https if specified, fallback to http in any other case
|
||||
if (options.protocol == 'https:') {
|
||||
if (options.protocol === 'https:') {
|
||||
request = https.request(options);
|
||||
} else {
|
||||
request = http.request(options);
|
||||
}
|
||||
|
||||
// get content length and fire away
|
||||
this.getLength(function(err, length) {
|
||||
this.getLength(function (err, length) {
|
||||
if (err && err !== 'Unknown stream') {
|
||||
this._error(err);
|
||||
return;
|
||||
@@ -476,7 +464,7 @@ FormData.prototype.submit = function(params, cb) {
|
||||
request.removeListener('error', callback);
|
||||
request.removeListener('response', onResponse);
|
||||
|
||||
return cb.call(this, error, responce);
|
||||
return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
|
||||
};
|
||||
|
||||
onResponse = callback.bind(this, null);
|
||||
@@ -489,7 +477,7 @@ FormData.prototype.submit = function(params, cb) {
|
||||
return request;
|
||||
};
|
||||
|
||||
FormData.prototype._error = function(err) {
|
||||
FormData.prototype._error = function (err) {
|
||||
if (!this.error) {
|
||||
this.error = err;
|
||||
this.pause();
|
||||
@@ -501,3 +489,6 @@ FormData.prototype.toString = function () {
|
||||
return '[object FormData]';
|
||||
};
|
||||
setToStringTag(FormData, 'FormData');
|
||||
|
||||
// Public API
|
||||
module.exports = FormData;
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
// populates missing values
|
||||
module.exports = function(dst, src) {
|
||||
'use strict';
|
||||
|
||||
Object.keys(src).forEach(function(prop)
|
||||
{
|
||||
dst[prop] = dst[prop] || src[prop];
|
||||
// populates missing values
|
||||
module.exports = function (dst, src) {
|
||||
Object.keys(src).forEach(function (prop) {
|
||||
dst[prop] = dst[prop] || src[prop]; // eslint-disable-line no-param-reassign
|
||||
});
|
||||
|
||||
return dst;
|
||||
|
||||
+24
-16
@@ -2,7 +2,7 @@
|
||||
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
|
||||
"name": "form-data",
|
||||
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
||||
"version": "4.0.2",
|
||||
"version": "4.0.4",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/form-data/form-data.git"
|
||||
@@ -28,15 +28,14 @@
|
||||
"files": "pkgfiles --sort=name",
|
||||
"get-version": "node -e \"console.log(require('./package.json').version)\"",
|
||||
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md",
|
||||
"restore-readme": "mv README.md.bak README.md",
|
||||
"prepublish": "in-publish && npm run update-readme || not-in-publish",
|
||||
"postpublish": "npm run restore-readme"
|
||||
"postupdate-readme": "mv README.md.bak READ.ME.md.bak",
|
||||
"restore-readme": "mv READ.ME.md.bak README.md",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepack": "npm run update-readme",
|
||||
"postpack": "npm run restore-readme",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"ci-test",
|
||||
"check"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
@@ -44,17 +43,17 @@
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/combined-stream": "^1.0.6",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"@types/node": "^12.20.55",
|
||||
"@ljharb/eslint-config": "^21.2.0",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"browserify": "^13.3.0",
|
||||
"browserify-istanbul": "^2.0.0",
|
||||
"coveralls": "^3.1.1",
|
||||
"cross-spawn": "^6.0.6",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint": "=8.8.0",
|
||||
"fake": "^0.2.2",
|
||||
"far": "^0.0.7",
|
||||
"formidable": "^1.2.6",
|
||||
@@ -64,11 +63,20 @@
|
||||
"obake": "^0.1.2",
|
||||
"pkgfiles": "^2.3.2",
|
||||
"pre-commit": "^1.2.2",
|
||||
"predict-v8-randomness": "^1.0.35",
|
||||
"puppeteer": "^1.20.0",
|
||||
"request": "~2.87.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "^3.9.10"
|
||||
"semver": "^6.3.1",
|
||||
"tape": "^5.9.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WebSocket = void 0;
|
||||
const WebSocket_ = require("ws");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
exports.WebSocket = (() => {
|
||||
try {
|
||||
return (0, utils_js_1.getNativeWebSocket)();
|
||||
}
|
||||
catch {
|
||||
if (WebSocket_.WebSocket)
|
||||
return WebSocket_.WebSocket;
|
||||
return WebSocket_;
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"type":"commonjs"}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getNativeWebSocket = void 0;
|
||||
function getNativeWebSocket() {
|
||||
if (typeof WebSocket !== "undefined")
|
||||
return WebSocket;
|
||||
if (typeof global.WebSocket !== "undefined")
|
||||
return global.WebSocket;
|
||||
if (typeof window.WebSocket !== "undefined")
|
||||
return window.WebSocket;
|
||||
if (typeof self.WebSocket !== "undefined")
|
||||
return self.WebSocket;
|
||||
throw new Error("`WebSocket` is not supported in this environment");
|
||||
}
|
||||
exports.getNativeWebSocket = getNativeWebSocket;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "isows",
|
||||
"description": "Isomorphic WebSocket",
|
||||
"version": "1.0.7",
|
||||
"browser": "./_esm/native.js",
|
||||
"main": "./_cjs/index.js",
|
||||
"module": "./_esm/index.js",
|
||||
"types": "./_types/native.d.ts",
|
||||
"typings": "./_types/native.d.ts",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"*",
|
||||
"!**/*.tsbuildinfo",
|
||||
"!**/*.test.ts",
|
||||
"!**/*.test.ts.snap",
|
||||
"!**/*.test-d.ts",
|
||||
"!**/*.bench.ts",
|
||||
"!tsconfig.build.json"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./_types/native.d.ts",
|
||||
"bun": "./_esm/native.js",
|
||||
"browser": "./_esm/native.js",
|
||||
"deno": "./_esm/native.js",
|
||||
"workerd": "./_esm/native.js",
|
||||
"react-native": "./_esm/native.js",
|
||||
"import": "./_esm/index.js",
|
||||
"default": "./_cjs/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ws": "*"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": "wevm/isows",
|
||||
"authors": [
|
||||
"jxom.eth"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wevm"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"isomorphic",
|
||||
"websocket",
|
||||
"ws",
|
||||
"node",
|
||||
"browser"
|
||||
]
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+11
-11
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-mock-http",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "",
|
||||
"repository": "unjs/node-mock-http",
|
||||
"license": "MIT",
|
||||
@@ -47,17 +47,17 @@
|
||||
"test:types": "tsc --noEmit --skipLibCheck"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.12.0",
|
||||
"@vitest/coverage-v8": "^3.0.4",
|
||||
"automd": "^0.3.12",
|
||||
"changelogen": "^0.5.7",
|
||||
"eslint": "^9.19.0",
|
||||
"@types/node": "^24.0.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"automd": "^0.4.0",
|
||||
"changelogen": "^0.6.1",
|
||||
"eslint": "^9.29.0",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"jiti": "^2.4.2",
|
||||
"prettier": "^3.4.2",
|
||||
"typescript": "^5.7.3",
|
||||
"unbuild": "^3.3.1",
|
||||
"vitest": "^3.0.4"
|
||||
"prettier": "^3.6.1",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.2.0"
|
||||
"packageManager": "pnpm@10.12.3"
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* pinia v3.0.2
|
||||
* pinia v3.0.3
|
||||
* (c) 2025 Eduardo San Martin Morote
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pinia",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"description": "Intuitive, type safe and flexible Store for Vue",
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
@@ -83,7 +83,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/pinia/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/pinia#readme",
|
||||
"homepage": "https://pinia.vuejs.org",
|
||||
"scripts": {
|
||||
"build": "rimraf dist && rollup -c ../../rollup.config.mjs --environment TARGET:pinia",
|
||||
"build:dts": "api-extractor run --local --verbose && tail -n +3 ./src/globalExtensions.ts >> dist/pinia.d.ts",
|
||||
|
||||
+2
-2
@@ -236,9 +236,9 @@ function A11y(_ref) {
|
||||
requestAnimationFrame(() => {
|
||||
if (preventFocusHandler) return;
|
||||
if (swiper.params.loop) {
|
||||
swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0);
|
||||
swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'))), 0);
|
||||
} else {
|
||||
swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
|
||||
swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0);
|
||||
}
|
||||
preventFocusHandler = false;
|
||||
});
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ function Keyboard(_ref) {
|
||||
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
|
||||
return undefined;
|
||||
}
|
||||
if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
|
||||
if (document.activeElement && (document.activeElement.isContentEditable || document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea'))) {
|
||||
return undefined;
|
||||
}
|
||||
if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "swiper",
|
||||
"version": "11.2.8",
|
||||
"version": "11.2.10",
|
||||
"description": "Most modern mobile touch slider and framework with hardware accelerated transitions",
|
||||
"typings": "swiper.d.ts",
|
||||
"type": "module",
|
||||
@@ -209,5 +209,5 @@
|
||||
"engines": {
|
||||
"node": ">= 4.7.0"
|
||||
},
|
||||
"releaseDate": "May 23, 2025"
|
||||
"releaseDate": "June 28, 2025"
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ function classesToSelector(classes) {
|
||||
if (classes === void 0) {
|
||||
classes = '';
|
||||
}
|
||||
return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
|
||||
return `.${classes.trim().replace(/([\.:!+\/()[\]])/g, '\\$1') // eslint-disable-line
|
||||
.replace(/ /g, '.')}`;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* SSR Window 5.0.0
|
||||
* SSR Window 5.0.1
|
||||
* Better handling for window object in SSR environment
|
||||
* https://github.com/nolimits4web/ssr-window
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Licensed under MIT
|
||||
*
|
||||
* Released on: February 12, 2025
|
||||
* Released on: June 27, 2025
|
||||
*/
|
||||
/* eslint-disable no-param-reassign */
|
||||
function isObject(obj) {
|
||||
|
||||
+28
-12
@@ -1768,23 +1768,16 @@ function slideToClickedSlide() {
|
||||
slidesEl
|
||||
} = swiper;
|
||||
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
|
||||
let slideToIndex = swiper.clickedIndex;
|
||||
let slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex);
|
||||
let realIndex;
|
||||
const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
|
||||
const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
||||
if (params.loop) {
|
||||
if (swiper.animating) return;
|
||||
realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
|
||||
if (params.centeredSlides) {
|
||||
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
|
||||
swiper.loopFix();
|
||||
slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
|
||||
nextTick(() => {
|
||||
swiper.slideTo(slideToIndex);
|
||||
});
|
||||
} else {
|
||||
swiper.slideTo(slideToIndex);
|
||||
}
|
||||
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
|
||||
swiper.slideToLoop(realIndex);
|
||||
} else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) {
|
||||
swiper.loopFix();
|
||||
slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
|
||||
nextTick(() => {
|
||||
@@ -1821,7 +1814,20 @@ function loopCreate(slideRealIndex, initial) {
|
||||
el.setAttribute('data-swiper-slide-index', index);
|
||||
});
|
||||
};
|
||||
const clearBlankSlides = () => {
|
||||
const slides = elementChildren(slidesEl, `.${params.slideBlankClass}`);
|
||||
slides.forEach(el => {
|
||||
el.remove();
|
||||
});
|
||||
if (slides.length > 0) {
|
||||
swiper.recalcSlides();
|
||||
swiper.updateSlides();
|
||||
}
|
||||
};
|
||||
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
||||
if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) {
|
||||
clearBlankSlides();
|
||||
}
|
||||
const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
|
||||
const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
|
||||
const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
|
||||
@@ -1913,7 +1919,7 @@ function loopFix(_temp) {
|
||||
}
|
||||
}
|
||||
const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
|
||||
let loopedSlides = slidesPerGroup;
|
||||
let loopedSlides = centeredSlides ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup;
|
||||
if (loopedSlides % slidesPerGroup !== 0) {
|
||||
loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
|
||||
}
|
||||
@@ -3511,6 +3517,16 @@ class Swiper {
|
||||
getSlideIndexByData(index) {
|
||||
return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index));
|
||||
}
|
||||
getSlideIndexWhenGrid(index) {
|
||||
if (this.grid && this.params.grid && this.params.grid.rows > 1) {
|
||||
if (this.params.grid.fill === 'column') {
|
||||
index = Math.floor(index / this.params.grid.rows);
|
||||
} else if (this.params.grid.fill === 'row') {
|
||||
index = index % Math.ceil(this.slides.length / this.params.grid.rows);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
recalcSlides() {
|
||||
const swiper = this;
|
||||
const {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Swiper Vue 11.2.8
|
||||
* Swiper Vue 11.2.10
|
||||
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||
* https://swiperjs.com
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Released under the MIT License
|
||||
*
|
||||
* Released on: May 23, 2025
|
||||
* Released on: June 28, 2025
|
||||
*/
|
||||
|
||||
import { h, ref, onUpdated, provide, watch, nextTick, onMounted, onBeforeUnmount, onBeforeUpdate, computed, inject } from 'vue';
|
||||
@@ -565,7 +565,7 @@ const Swiper = {
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ['_beforeBreakpoint', '_containerClasses', '_slideClass', '_slideClasses', '_swiper', '_freeModeNoMomentumRelease', 'activeIndexChange', 'afterInit', 'autoplay', 'autoplayStart', 'autoplayStop', 'autoplayPause', 'autoplayResume', 'autoplayTimeLeft', 'beforeDestroy', 'beforeInit', 'beforeLoopFix', 'beforeResize', 'beforeSlideChangeStart', 'beforeTransitionStart', 'breakpoint', 'changeDirection', 'click', 'disable', 'doubleTap', 'doubleClick', 'destroy', 'enable', 'fromEdge', 'hashChange', 'hashSet', 'init', 'keyPress', 'lock', 'loopFix', 'momentumBounce', 'navigationHide', 'navigationShow', 'navigationPrev', 'navigationNext', 'observerUpdate', 'orientationchange', 'paginationHide', 'paginationRender', 'paginationShow', 'paginationUpdate', 'progress', 'reachBeginning', 'reachEnd', 'realIndexChange', 'resize', 'scroll', 'scrollbarDragEnd', 'scrollbarDragMove', 'scrollbarDragStart', 'setTransition', 'setTranslate', 'slidesUpdated', 'slideChange', 'slideChangeTransitionEnd', 'slideChangeTransitionStart', 'slideNextTransitionEnd', 'slideNextTransitionStart', 'slidePrevTransitionEnd', 'slidePrevTransitionStart', 'slideResetTransitionStart', 'slideResetTransitionEnd', 'sliderMove', 'sliderFirstMove', 'slidesLengthChange', 'slidesGridLengthChange', 'snapGridLengthChange', 'snapIndexChange', 'swiper', 'tap', 'toEdge', 'touchEnd', 'touchMove', 'touchMoveOpposite', 'touchStart', 'transitionEnd', 'transitionStart', 'unlock', 'update', 'virtualUpdate', 'zoomChange'],
|
||||
emits: ['_beforeBreakpoint', '_containerClasses', '_slideClass', '_slideClasses', '_swiper', '_freeModeNoMomentumRelease', '_virtualUpdated', 'activeIndexChange', 'afterInit', 'autoplay', 'autoplayStart', 'autoplayStop', 'autoplayPause', 'autoplayResume', 'autoplayTimeLeft', 'beforeDestroy', 'beforeInit', 'beforeLoopFix', 'beforeResize', 'beforeSlideChangeStart', 'beforeTransitionStart', 'breakpoint', 'changeDirection', 'click', 'disable', 'doubleTap', 'doubleClick', 'destroy', 'enable', 'fromEdge', 'hashChange', 'hashSet', 'init', 'keyPress', 'lock', 'loopFix', 'momentumBounce', 'navigationHide', 'navigationShow', 'navigationPrev', 'navigationNext', 'observerUpdate', 'orientationchange', 'paginationHide', 'paginationRender', 'paginationShow', 'paginationUpdate', 'progress', 'reachBeginning', 'reachEnd', 'realIndexChange', 'resize', 'scroll', 'scrollbarDragEnd', 'scrollbarDragMove', 'scrollbarDragStart', 'setTransition', 'setTranslate', 'slidesUpdated', 'slideChange', 'slideChangeTransitionEnd', 'slideChangeTransitionStart', 'slideNextTransitionEnd', 'slideNextTransitionStart', 'slidePrevTransitionEnd', 'slidePrevTransitionStart', 'slideResetTransitionStart', 'slideResetTransitionEnd', 'sliderMove', 'sliderFirstMove', 'slidesLengthChange', 'slidesGridLengthChange', 'snapGridLengthChange', 'snapIndexChange', 'swiper', 'tap', 'toEdge', 'touchEnd', 'touchMove', 'touchMoveOpposite', 'touchStart', 'transitionEnd', 'transitionStart', 'unlock', 'update', 'virtualUpdate', 'zoomChange'],
|
||||
setup(props, _ref) {
|
||||
let {
|
||||
slots: originalSlots,
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Swiper 11.2.8
|
||||
* Swiper 11.2.10
|
||||
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||
* https://swiperjs.com
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Released under the MIT License
|
||||
*
|
||||
* Released on: May 23, 2025
|
||||
* Released on: June 28, 2025
|
||||
*/
|
||||
|
||||
export { S as Swiper, S as default } from './shared/swiper-core.mjs';
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.BPM0-cfG.mjs';
|
||||
export { c as createHeadCore, a as createUnhead } from './shared/unhead.CXyUfY4l.mjs';
|
||||
export { c as createHeadCore, a as createUnhead } from './shared/unhead.CAk5S5m6.mjs';
|
||||
export { u as useScript } from './shared/unhead.B578PsDV.mjs';
|
||||
import './shared/unhead.CApf5sj3.mjs';
|
||||
import './shared/unhead.DQc16pHI.mjs';
|
||||
import './shared/unhead.yem5I2v_.mjs';
|
||||
import 'hookable';
|
||||
import './shared/unhead.ytfIU1HR.mjs';
|
||||
import './shared/unhead.Di5OD67x.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { a as createUnhead } from './shared/unhead.CXyUfY4l.mjs';
|
||||
import { a as createUnhead } from './shared/unhead.CAk5S5m6.mjs';
|
||||
import { T as TagsWithInnerContent, S as SelfClosingTags$1 } from './shared/unhead.yem5I2v_.mjs';
|
||||
import 'hookable';
|
||||
import './shared/unhead.ytfIU1HR.mjs';
|
||||
import './shared/unhead.Di5OD67x.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
|
||||
Generated
Vendored
+14
-6
@@ -1,5 +1,5 @@
|
||||
import { createHooks } from 'hookable';
|
||||
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.ytfIU1HR.mjs';
|
||||
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.Di5OD67x.mjs';
|
||||
import { t as tagWeight, s as sortTags } from './unhead.DZbvapt-.mjs';
|
||||
import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
@@ -23,7 +23,7 @@ function createUnhead(resolvedOptions = {}) {
|
||||
const ssr = !resolvedOptions.document;
|
||||
const entries = /* @__PURE__ */ new Map();
|
||||
const plugins = /* @__PURE__ */ new Map();
|
||||
const normalizeQueue = [];
|
||||
const normalizeQueue = /* @__PURE__ */ new Set();
|
||||
const head = {
|
||||
_entryCount: 1,
|
||||
// 0 is reserved for internal use
|
||||
@@ -45,12 +45,12 @@ function createUnhead(resolvedOptions = {}) {
|
||||
const _ = {
|
||||
_poll(rm = false) {
|
||||
head.dirty = true;
|
||||
!rm && normalizeQueue.push(_i);
|
||||
!rm && normalizeQueue.add(_i);
|
||||
hooks.callHook("entries:updated", head);
|
||||
},
|
||||
dispose() {
|
||||
if (entries.delete(_i)) {
|
||||
_._poll(true);
|
||||
head.invalidate();
|
||||
}
|
||||
},
|
||||
// a patch is the same as creating a new entry, just a nice DX
|
||||
@@ -72,8 +72,9 @@ function createUnhead(resolvedOptions = {}) {
|
||||
entries: [...head.entries.values()]
|
||||
};
|
||||
await hooks.callHook("entries:resolve", ctx);
|
||||
while (normalizeQueue.length) {
|
||||
const i = normalizeQueue.shift();
|
||||
while (normalizeQueue.size) {
|
||||
const i = normalizeQueue.values().next().value;
|
||||
normalizeQueue.delete(i);
|
||||
const e = entries.get(i);
|
||||
if (e) {
|
||||
const normalizeCtx = {
|
||||
@@ -161,6 +162,13 @@ function createUnhead(resolvedOptions = {}) {
|
||||
finalTags.push(t);
|
||||
}
|
||||
return finalTags;
|
||||
},
|
||||
invalidate() {
|
||||
for (const entry of entries.values()) {
|
||||
normalizeQueue.add(entry._i);
|
||||
}
|
||||
head.dirty = true;
|
||||
hooks.callHook("entries:updated", head);
|
||||
}
|
||||
};
|
||||
(resolvedOptions?.plugins || []).forEach((p) => registerPlugin(head, p));
|
||||
Generated
Vendored
+12
-1
@@ -1,6 +1,12 @@
|
||||
import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
const allowedMetaProperties = ["name", "property", "http-equiv"];
|
||||
const StandardSingleMetaTags = /* @__PURE__ */ new Set([
|
||||
"viewport",
|
||||
"description",
|
||||
"keywords",
|
||||
"robots"
|
||||
]);
|
||||
function isMetaArrayDupeKey(v) {
|
||||
const parts = v.split(":");
|
||||
if (!parts.length)
|
||||
@@ -18,7 +24,12 @@ function dedupeKey(tag) {
|
||||
if (tag.tag === "meta") {
|
||||
for (const n of allowedMetaProperties) {
|
||||
if (props[n] !== void 0) {
|
||||
return `${name}:${props[n]}`;
|
||||
const propValue = props[n];
|
||||
const isStructured = propValue.includes(":");
|
||||
const isStandardSingle = StandardSingleMetaTags.has(propValue);
|
||||
const shouldAlwaysDedupe = isStructured || isStandardSingle;
|
||||
const keyPart = !shouldAlwaysDedupe && tag.key ? `:key:${tag.key}` : "";
|
||||
return `${name}:${propValue}${keyPart}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, b as ScriptNetworkEvents, S as SelfClosingTags, a as TagConfigKeys, T as TagsWithInnerContent, U as UniqueTags, c as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.yem5I2v_.mjs';
|
||||
export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.ytfIU1HR.mjs';
|
||||
export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.Di5OD67x.mjs';
|
||||
export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.DQc16pHI.mjs';
|
||||
export { s as sortTags, t as tagWeight } from './shared/unhead.DZbvapt-.mjs';
|
||||
export { p as processTemplateParams } from './shared/unhead.C13swrCa.mjs';
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "unhead",
|
||||
"type": "module",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.12",
|
||||
"description": "Full-stack <head> manager built for any framework.",
|
||||
"author": {
|
||||
"name": "Harlan Wilton",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue v3.5.14
|
||||
* vue v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vue v3.5.14
|
||||
* vue v3.5.18
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue",
|
||||
"version": "3.5.14",
|
||||
"version": "3.5.18",
|
||||
"description": "The progressive JavaScript framework for building modern web UI.",
|
||||
"main": "index.js",
|
||||
"module": "dist/vue.runtime.esm-bundler.js",
|
||||
@@ -95,11 +95,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.14",
|
||||
"@vue/runtime-dom": "3.5.14",
|
||||
"@vue/compiler-sfc": "3.5.14",
|
||||
"@vue/compiler-dom": "3.5.14",
|
||||
"@vue/server-renderer": "3.5.14"
|
||||
"@vue/shared": "3.5.18",
|
||||
"@vue/compiler-dom": "3.5.18",
|
||||
"@vue/compiler-sfc": "3.5.18",
|
||||
"@vue/server-renderer": "3.5.18",
|
||||
"@vue/runtime-dom": "3.5.18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*"
|
||||
|
||||
+46
-42
@@ -1,5 +1,5 @@
|
||||
import { defineComponent as w, ref as f, computed as K, watch as T, onMounted as $, openBlock as c, createElementBlock as h, createElementVNode as F, normalizeClass as M, createCommentVNode as j, Fragment as R, renderList as N, createBlock as W } from "vue";
|
||||
const H = { style: { display: "flex", "align-items": "center" } }, S = ["type", "inputmode", "placeholder", "disabled", "maxlength", "value"], V = { key: 0 }, q = ["innerHTML"], z = /* @__PURE__ */ w({
|
||||
import { defineComponent as F, ref as f, computed as K, watch as T, onMounted as $, createElementBlock as h, openBlock as c, createElementVNode as B, createCommentVNode as j, normalizeClass as M, Fragment as R, renderList as N, createBlock as W } from "vue";
|
||||
const H = { style: { display: "flex", "align-items": "center" } }, S = ["type", "inputmode", "placeholder", "disabled", "maxlength", "value"], V = { key: 0 }, q = ["innerHTML"], z = /* @__PURE__ */ F({
|
||||
__name: "single-otp-input",
|
||||
props: {
|
||||
inputType: { default: "tel" },
|
||||
@@ -15,8 +15,8 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
isDisabled: { type: Boolean, default: !1 }
|
||||
},
|
||||
emits: ["on-change", "on-keydown", "on-paste", "on-focus", "on-blur"],
|
||||
setup(b, { emit: I }) {
|
||||
const s = b, l = I, i = f(s.value || ""), a = f(null), n = (e) => {
|
||||
setup(I, { emit: b }) {
|
||||
const s = I, l = b, i = f(s.value || ""), n = f(null), a = (e) => {
|
||||
const u = e.target.value;
|
||||
return u && u.trim().length > 1 ? (e.clipboardData = {
|
||||
getData: () => u.trim()
|
||||
@@ -24,8 +24,12 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
}, v = (e) => e >= 65 && e <= 90, D = (e) => e >= 48 && e <= 57 || e >= 96 && e <= 105, k = (e) => {
|
||||
s.isDisabled && e.preventDefault();
|
||||
const u = e || window.event, r = u.which ? u.which : u.keyCode;
|
||||
if (/iPhone|iPad|iPod/.test(navigator.userAgent)) {
|
||||
l("on-keydown", e);
|
||||
return;
|
||||
}
|
||||
D(r) || s.inputType === "letter-numeric" && v(r) || [8, 9, 13, 37, 39, 46, 86].includes(r) ? l("on-keydown", e) : u.preventDefault();
|
||||
}, m = (e) => l("on-paste", e), d = () => (a.value.select(), l("on-focus")), y = () => l("on-blur"), g = K(
|
||||
}, m = (e) => l("on-paste", e), d = () => (n.value.select(), l("on-focus")), y = () => l("on-blur"), g = K(
|
||||
() => ["letter-numeric", "number"].includes(s.inputType) ? "text" : s.inputType
|
||||
);
|
||||
return T(
|
||||
@@ -36,33 +40,33 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
), T(
|
||||
() => s.focus,
|
||||
(e, u) => {
|
||||
u !== e && a.value && s.focus && (a.value.focus(), a.value.select());
|
||||
u !== e && n.value && s.focus && (n.value.focus(), n.value.select());
|
||||
}
|
||||
), $(() => {
|
||||
a.value && s.focus && s.shouldAutoFocus && (a.value.focus(), a.value.select());
|
||||
n.value && s.focus && s.shouldAutoFocus && (n.value.focus(), n.value.select());
|
||||
}), (e, u) => (c(), h("div", H, [
|
||||
F("input", {
|
||||
B("input", {
|
||||
"data-test": "single-input",
|
||||
type: g.value,
|
||||
inputmode: e.inputmode,
|
||||
placeholder: e.placeholder,
|
||||
disabled: e.isDisabled,
|
||||
ref_key: "input",
|
||||
ref: a,
|
||||
ref: n,
|
||||
min: "0",
|
||||
max: "9",
|
||||
maxlength: e.isLastChild ? 1 : void 0,
|
||||
pattern: "[0-9]",
|
||||
value: i.value,
|
||||
class: M([e.inputClasses, e.conditionalClass, { "is-complete": i.value }]),
|
||||
onInput: n,
|
||||
onInput: a,
|
||||
onKeydown: k,
|
||||
onPaste: m,
|
||||
onFocus: d,
|
||||
onBlur: y
|
||||
}, null, 42, S),
|
||||
!e.isLastChild && e.separator ? (c(), h("span", V, [
|
||||
F("span", { innerHTML: e.separator }, null, 8, q)
|
||||
B("span", { innerHTML: e.separator }, null, 8, q)
|
||||
])) : j("", !0)
|
||||
]));
|
||||
}
|
||||
@@ -75,7 +79,7 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
name: "hidden",
|
||||
type: "text",
|
||||
style: { display: "none" }
|
||||
}, Q = 8, U = 37, X = 39, Y = 46, x = /* @__PURE__ */ w({
|
||||
}, Q = 8, U = 37, X = 39, Y = 46, x = /* @__PURE__ */ F({
|
||||
__name: "vue3-otp-input",
|
||||
props: {
|
||||
value: { default: "" },
|
||||
@@ -91,47 +95,47 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
shouldFocusOrder: { type: Boolean }
|
||||
},
|
||||
emits: ["update:value", "on-change", "on-complete"],
|
||||
setup(b, { expose: I, emit: s }) {
|
||||
const l = b, i = s, a = f(0), n = f([]), v = f([]);
|
||||
setup(I, { expose: b, emit: s }) {
|
||||
const l = I, i = s, n = f(0), a = f([]), v = f([]);
|
||||
T(
|
||||
() => l.value,
|
||||
(t) => {
|
||||
if (t.length === l.numInputs || n.value.length === 0) {
|
||||
if (t.length === l.numInputs || a.value.length === 0) {
|
||||
const o = t.split("");
|
||||
n.value = o;
|
||||
a.value = o;
|
||||
}
|
||||
},
|
||||
{ immediate: !0 }
|
||||
);
|
||||
const D = (t) => {
|
||||
a.value = t;
|
||||
n.value = t;
|
||||
}, k = () => {
|
||||
a.value = -1;
|
||||
}, m = () => n.value.join("").length === l.numInputs ? (i("update:value", n.value.join("")), i("on-complete", n.value.join(""))) : "Wait until the user enters the required number of characters", d = (t) => {
|
||||
a.value = Math.max(Math.min(l.numInputs - 1, t), 0);
|
||||
n.value !== l.numInputs - 1 && (n.value = -1);
|
||||
}, m = () => a.value.join("").length === l.numInputs ? (i("update:value", a.value.join("")), i("on-complete", a.value.join(""))) : "Wait until the user enters the required number of characters", d = (t) => {
|
||||
n.value = Math.max(Math.min(l.numInputs - 1, t), 0);
|
||||
}, y = () => {
|
||||
d(a.value + 1);
|
||||
d(n.value + 1);
|
||||
}, g = () => {
|
||||
d(a.value - 1);
|
||||
d(n.value - 1);
|
||||
}, e = (t) => {
|
||||
v.value = Object.assign([], n.value), n.value[a.value] = t.toString(), v.value.join("") !== n.value.join("") && (i("update:value", n.value.join("")), i("on-change", n.value.join("")), m());
|
||||
v.value = Object.assign([], a.value), a.value[n.value] = t.toString(), v.value.join("") !== a.value.join("") && (i("update:value", a.value.join("")), i("on-change", a.value.join("")), m());
|
||||
}, u = (t) => {
|
||||
t.preventDefault();
|
||||
const o = t.clipboardData.getData("text/plain").slice(0, l.numInputs - a.value).split("");
|
||||
const o = t.clipboardData.getData("text/plain").slice(0, l.numInputs - n.value).split("");
|
||||
if (l.inputType === "number" && !o.join("").match(/^\d+$/) || l.inputType === "letter-numeric" && !o.join("").match(/^\w+$/))
|
||||
return "Invalid pasted data";
|
||||
const p = n.value.slice(0, a.value).concat(o);
|
||||
const p = a.value.slice(0, n.value).concat(o);
|
||||
return p.slice(0, l.numInputs).forEach(function(O, C) {
|
||||
n.value[C] = O;
|
||||
a.value[C] = O;
|
||||
}), d(p.slice(0, l.numInputs).length), m();
|
||||
}, r = (t) => {
|
||||
e(t), y();
|
||||
e(t), n.value < l.numInputs - 1 && y();
|
||||
}, A = () => {
|
||||
n.value.length > 0 && (i("update:value", ""), i("on-change", "")), n.value = [], a.value = 0;
|
||||
}, E = (t) => {
|
||||
a.value.length > 0 && (i("update:value", ""), i("on-change", "")), a.value = [], n.value = 0;
|
||||
}, P = (t) => {
|
||||
const o = t.split("");
|
||||
o.length === l.numInputs && (n.value = o, i("update:value", n.value.join("")), i("on-complete", n.value.join("")));
|
||||
}, L = (t, o) => {
|
||||
o.length === l.numInputs && (a.value = o, i("update:value", a.value.join("")), i("on-complete", a.value.join("")));
|
||||
}, E = (t, o) => {
|
||||
switch (t.keyCode) {
|
||||
case Q:
|
||||
t.preventDefault(), e(""), g();
|
||||
@@ -146,26 +150,26 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
t.preventDefault(), y();
|
||||
break;
|
||||
default:
|
||||
_(o);
|
||||
L(o);
|
||||
break;
|
||||
}
|
||||
}, _ = (t) => {
|
||||
}, L = (t) => {
|
||||
l.shouldFocusOrder && setTimeout(() => {
|
||||
const o = n.value.join("").length;
|
||||
t - o >= 0 && (a.value = o, n.value[t] = "");
|
||||
const o = a.value.join("").length;
|
||||
t - o >= 0 && (n.value = o, a.value[t] = "");
|
||||
}, 100);
|
||||
};
|
||||
return I({
|
||||
return b({
|
||||
clearInput: A,
|
||||
fillInput: E
|
||||
fillInput: P
|
||||
}), (t, o) => (c(), h("div", G, [
|
||||
t.inputType === "password" ? (c(), h("input", J)) : j("", !0),
|
||||
(c(!0), h(R, null, N(t.numInputs, (P, p) => {
|
||||
(c(!0), h(R, null, N(t.numInputs, (_, p) => {
|
||||
var O, C;
|
||||
return c(), W(z, {
|
||||
key: p,
|
||||
focus: a.value === p,
|
||||
value: n.value[p],
|
||||
focus: n.value === p,
|
||||
value: a.value[p],
|
||||
separator: t.separator,
|
||||
"input-type": t.inputType,
|
||||
inputmode: t.inputmode,
|
||||
@@ -176,9 +180,9 @@ const H = { style: { display: "flex", "align-items": "center" } }, S = ["type",
|
||||
placeholder: (C = t.placeholder) == null ? void 0 : C[p],
|
||||
"is-disabled": t.isDisabled,
|
||||
onOnChange: r,
|
||||
onOnKeydown: (B) => L(B, p),
|
||||
onOnKeydown: (w) => E(w, p),
|
||||
onOnPaste: u,
|
||||
onOnFocus: (B) => D(p),
|
||||
onOnFocus: (w) => D(p),
|
||||
onOnBlur: k
|
||||
}, null, 8, ["focus", "value", "separator", "input-type", "inputmode", "input-classes", "conditionalClass", "is-last-child", "should-auto-focus", "placeholder", "is-disabled", "onOnKeydown", "onOnFocus"]);
|
||||
}), 128))
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue3-otp-input",
|
||||
"version": "0.5.30",
|
||||
"version": "0.5.40",
|
||||
"description": "A fully customizable, OTP (one-time password) input component built with Vue 3.x and Vue Composition API.",
|
||||
"author": "Ejiro Asiuwhu <ejiroasiuwhu10@gmail.com>",
|
||||
"repository": "https://github.com/ejirocodes/vue3-otp-input",
|
||||
|
||||
+14
-4
@@ -256,9 +256,11 @@ class WebSocketServer extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
if (version !== 8 && version !== 13) {
|
||||
if (version !== 13 && version !== 8) {
|
||||
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
||||
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
||||
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
||||
'Sec-WebSocket-Version': '13, 8'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -526,15 +528,23 @@ function abortHandshake(socket, code, message, headers) {
|
||||
* @param {Duplex} socket The socket of the upgrade request
|
||||
* @param {Number} code The HTTP response status code
|
||||
* @param {String} message The HTTP response body
|
||||
* @param {Object} [headers] The HTTP response headers
|
||||
* @private
|
||||
*/
|
||||
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
||||
function abortHandshakeOrEmitwsClientError(
|
||||
server,
|
||||
req,
|
||||
socket,
|
||||
code,
|
||||
message,
|
||||
headers
|
||||
) {
|
||||
if (server.listenerCount('wsClientError')) {
|
||||
const err = new Error(message);
|
||||
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
||||
|
||||
server.emit('wsClientError', err, socket, req);
|
||||
} else {
|
||||
abortHandshake(socket, code, message);
|
||||
abortHandshake(socket, code, message, headers);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ws",
|
||||
"version": "8.18.2",
|
||||
"version": "8.18.3",
|
||||
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
|
||||
"keywords": [
|
||||
"HyBi",
|
||||
|
||||
Reference in New Issue
Block a user