New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gez/class-state

Package Overview
Dependencies
Maintainers
0
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gez/class-state - npm Package Compare versions

Comparing version 0.0.15 to 3.0.0-alpha.1

6

dist/connect.d.ts

@@ -78,8 +78,4 @@ import { type State, type StateContext } from './create';

/**
* @deprecated 请使用 ffiStore
* 连接外部的 store,如果没有,则实例化 Store 类作为默认值返回
*/
export declare function foreignStore<T extends StoreConstructor>(Store: T, name: string, cacheKey?: string): InstanceType<T> | null;
/**
* 查找一个外部的 Store
*/
export declare function ffiStore<T extends {}>(name: string, cacheKey?: string): T | null;

2

dist/index.d.ts
export { createState, type State } from './create';
export { connectState, foreignStore, ffiStore, type StoreConstructor, type StoreContext, type StoreInstance, type StoreParams, LIFE_CYCLE_CREATED, LIFE_CYCLE_DISPOSE } from './connect';
export { connectState, foreignStore, type StoreConstructor, type StoreContext, type StoreInstance, type StoreParams, LIFE_CYCLE_CREATED, LIFE_CYCLE_DISPOSE } from './connect';

@@ -5,3 +5,3 @@ {

"scripts": {
"lint:js": "eslint . --ext .js,.mjs,.cjs,.ts,.vue --fix",
"lint:js": "biome check --write --no-errors-on-unmatched",
"lint:css": "stylelint '**/*.{css,vue}' --fix --aei",

@@ -17,7 +17,7 @@ "lint:type": "tsc --noEmit",

"devDependencies": {
"@gez/lint": "0.0.15",
"@biomejs/biome": "1.9.2",
"@gez/lint": "3.0.0-alpha.1",
"@types/node": "20.12.12",
"@vitest/coverage-v8": "1.6.0",
"@vue/compiler-dom": "^3.4.27",
"eslint": "8.57.0",
"@vue/compiler-dom": "^3.5.6",
"stylelint": "16.5.0",

@@ -27,5 +27,5 @@ "typescript": "5.4.5",

"vitest": "1.6.0",
"vue": "^3.4.27"
"vue": "^3.5.6"
},
"version": "0.0.15",
"version": "3.0.0-alpha.1",
"type": "module",

@@ -36,3 +36,4 @@ "private": false,

"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}

@@ -49,3 +50,3 @@ },

],
"gitHead": "b2f4fbfc059bb57b451e3afdd4676d00a842d965"
"gitHead": "c9dd9b6df81ba9e94e15a1e4054e193d744fec9a"
}
import { assert, test } from 'vitest';
import { connectState, ffiStore } from './connect';
import { connectState, foreignStore } from './connect';
import { createState } from './create';

@@ -233,3 +233,3 @@

public get blog() {
return ffiStore<Blog>('blog')!;
return foreignStore(Blog, 'blog')!;
}

@@ -381,4 +381,4 @@

class Count {
public value: number = 0;
public text: string = '';
public value = 0;
public text = '';
public $inc() {

@@ -423,3 +423,3 @@ this.value++;

class Count {
public value: number = 0;
public value = 0;
public $inc() {

@@ -444,3 +444,3 @@ this.value++;

class Count {
public value: number = 0;
public value = 0;
public $inc() {

@@ -447,0 +447,0 @@ this.value++;

/* eslint-disable @typescript-eslint/no-this-alias */
import { produce } from 'immer';
import { getStateContext, type State, type StateContext } from './create';
import { type State, type StateContext, getStateContext } from './create';
export type StoreParams = Record<string, any>;

@@ -272,3 +272,3 @@ export type StoreConstructor = new (cacheKey?: string) => any;

/**
* @deprecated 请使用 ffiStore
* 连接外部的 store,如果没有,则实例化 Store 类作为默认值返回
*/

@@ -280,11 +280,2 @@ export function foreignStore<T extends StoreConstructor>(

): InstanceType<T> | null {
return ffiStore<InstanceType<T>>(name, cacheKey);
}
/**
* 查找一个外部的 Store
*/
export function ffiStore<T extends {}>(
name: string,
cacheKey?: string
): T | null {
if (!currentStateContext) {

@@ -294,3 +285,3 @@ throw new Error('No state context found');

const fullPath = getFullPath(name, cacheKey);
const storeContext: StoreContext<T> | null =
const storeContext: StoreContext<InstanceType<T>> | null =
currentStateContext.get(fullPath);

@@ -297,0 +288,0 @@ if (storeContext) {

@@ -5,3 +5,2 @@ export { createState, type State } from './create';

foreignStore,
ffiStore,
type StoreConstructor,

@@ -8,0 +7,0 @@ type StoreContext,

@@ -17,3 +17,3 @@ import { assert, test } from 'vitest';

const user = connectStore(User, 'user');
let updateValue;
let updateValue: string | undefined;
watch(

@@ -47,3 +47,3 @@ () => {

user.$setName('test');
let updateValue;
let updateValue: string | undefined;
watch(

@@ -50,0 +50,0 @@ () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc