Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/core-loader

Package Overview
Dependencies
Maintainers
41
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/core-loader - npm Package Compare versions

Comparing version 0.3.6-pink-lizard to 0.4.0-pink-lizard

14

CHANGELOG.md
# Changelog
## [0.4.0-pink-lizard](https://github.com/sanity-io/visual-editing/compare/core-loader-v0.3.6-pink-lizard...core-loader-v0.4.0-pink-lizard) (2023-11-04)
### Features
* use the new `@sanity/client/stega` features ([#252](https://github.com/sanity-io/visual-editing/issues/252)) ([fa08bb2](https://github.com/sanity-io/visual-editing/commit/fa08bb24e6413bfa49adb79df256217e06ed0844))
### Bug Fixes
* **deps:** update dependency @sanity/client to v6.7.1-pink-lizard.2 ([#251](https://github.com/sanity-io/visual-editing/issues/251)) ([9f66693](https://github.com/sanity-io/visual-editing/commit/9f66693bd2e954f54987e9352f35f3fccab3ad6f))
* **deps:** update dependency @sanity/client to v6.7.1-pink-lizard.5 ([#259](https://github.com/sanity-io/visual-editing/issues/259)) ([8f2f00f](https://github.com/sanity-io/visual-editing/commit/8f2f00faef5a91dd11218b05be4c76da2ec45e0e))
* handle stega nodes in a way that supports focus ([#254](https://github.com/sanity-io/visual-editing/issues/254)) ([dce801f](https://github.com/sanity-io/visual-editing/commit/dce801f3b76e6e2bb0597345b5deacc2038e6fec))
## [0.3.6-pink-lizard](https://github.com/sanity-io/visual-editing/compare/core-loader-v0.3.5-pink-lizard...core-loader-v0.3.6-pink-lizard) (2023-11-03)

@@ -4,0 +18,0 @@

3

dist/index.d.ts

@@ -5,2 +5,3 @@ import { Cache as Cache_2 } from 'async-cache-dedupe'

import type { SanityClient } from '@sanity/client'
import type { SanityStegaClient } from '@sanity/client/stega'

@@ -18,3 +19,3 @@ declare const actionId: unique symbol

export declare interface CreateQueryStoreOptions {
client: SanityClient
client: SanityClient | SanityStegaClient
studioUrl: string

@@ -21,0 +22,0 @@ }

import { createCache } from 'async-cache-dedupe';
import { SanityStegaClient, stegaEncodeSourceMap } from '@sanity/client/stega';
let tasks = 0;

@@ -493,49 +494,61 @@ let resolves = [];

const cache = /* @__PURE__ */new Map();
onMount($LiveMode, () => {
if (typeof document === "undefined") return;
$LiveMode.setKey("enabled", true);
const studioOrigin = new URL(studioUrl, location.origin).origin;
$LiveMode.setKey("studioOrigin", studioOrigin);
channel = createChannel({
id: "loaders",
onStatusUpdate(status) {
if (status === "connected") {
$LiveMode.setKey("connected", true);
} else if (status === "disconnected" || status === "unhealthy") {
$LiveMode.setKey("connected", false);
if (typeof document !== "undefined") {
onMount($LiveMode, () => {
$LiveMode.setKey("enabled", true);
const studioOrigin = new URL(studioUrl, location.origin).origin;
$LiveMode.setKey("studioOrigin", studioOrigin);
channel = createChannel({
id: "loaders",
onStatusUpdate(status) {
if (status === "connected") {
$LiveMode.setKey("connected", true);
} else if (status === "disconnected" || status === "unhealthy") {
$LiveMode.setKey("connected", false);
}
},
connections: [{
target: parent,
targetOrigin: studioOrigin,
id: "presentation"
}],
handler: (type, data) => {
if (type === "loader/perspective" && data.projectId === projectId && data.dataset === dataset) {
$perspective.set(data.perspective);
updateLiveQueries();
} else if (type === "loader/query-change" && data.projectId === projectId && data.dataset === dataset) {
const {
perspective,
query,
params
} = data;
if (client instanceof SanityStegaClient && client.config().stega.enabled && data.resultSourceMap) {
cache.set(JSON.stringify({
perspective,
query,
params
}), {
...data,
result: stegaEncodeSourceMap(data.result, data.resultSourceMap, client.config().stega)
});
} else {
cache.set(JSON.stringify({
perspective,
query,
params
}), data);
}
updateLiveQueries();
}
}
},
connections: [{
target: parent,
targetOrigin: studioOrigin,
id: "presentation"
}],
handler: (type, data) => {
if (type === "loader/perspective" && data.projectId === projectId && data.dataset === dataset) {
$perspective.set(data.perspective);
updateLiveQueries();
} else if (type === "loader/query-change" && data.projectId === projectId && data.dataset === dataset) {
const {
perspective,
query,
params
} = data;
cache.set(JSON.stringify({
perspective,
query,
params
}), data);
updateLiveQueries();
}
}
});
const unlistenConnection = listenKeys($LiveMode, ["connected"], () => {});
return () => {
unlistenConnection();
$LiveMode.setKey("enabled", false);
$LiveMode.setKey("connected", false);
channel?.disconnect();
channel = null;
};
});
const unlistenConnection = listenKeys($LiveMode, ["connected"], () => {});
return () => {
unlistenConnection();
$LiveMode.setKey("enabled", false);
$LiveMode.setKey("connected", false);
channel?.disconnect();
channel = null;
};
});
}
const liveQueries = /* @__PURE__ */new Set();

@@ -542,0 +555,0 @@ const addLiveQuery = (query, params, $fetch) => {

{
"name": "@sanity/core-loader",
"version": "0.3.6-pink-lizard",
"version": "0.4.0-pink-lizard",
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/core-loader#readme",

@@ -100,10 +100,10 @@ "bugs": {

"async-cache-dedupe": "2.0.0",
"@sanity/groq-store": "5.0.1-pink-lizard"
"@sanity/groq-store": "5.1.0-pink-lizard"
},
"devDependencies": {
"@sanity/client": "6.7.1-pink-lizard.0",
"@sanity/client": "6.7.1-pink-lizard.5",
"@sanity/pkg-utils": "^3.2.2",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.52.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",

@@ -118,3 +118,3 @@ "eslint-plugin-prettier": "^5.0.1",

"peerDependencies": {
"@sanity/client": "6.7.1-pink-lizard.0"
"@sanity/client": "6.7.1-pink-lizard.5"
},

@@ -121,0 +121,0 @@ "engines": {

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