@builder.io/sdk-svelte 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -1,3 +1,7 @@
1
+ ### 0.5.5
2
+
3
+ - Fix: remove `lru-cache` import and usage.
4
+
1
5
  ### 0.5.4
2
6
 
3
7
  - Fix build issues caused by extraneous `acorn` import.
@@ -1 +1,2 @@
1
- export declare function getPreviewContent(searchParams: URLSearchParams): import("../../types/builder-content").BuilderContent | undefined;
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ export declare function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined;
@@ -1,7 +1,3 @@
1
- import { getIdFromSearchParams } from './helpers';
2
- import { init } from './init';
3
- export function getPreviewContent(searchParams) {
4
- init();
5
- const id = getIdFromSearchParams(searchParams);
6
- return typeof id === 'string' ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(id) : undefined;
1
+ export function getPreviewContent(_searchParams) {
2
+ return undefined;
7
3
  }
@@ -1 +0,0 @@
1
- export declare const getIdFromSearchParams: (searchParams: URLSearchParams) => string | null;
@@ -1,9 +1 @@
1
- import { logger } from '../logger';
2
- export const getIdFromSearchParams = (searchParams) => {
3
- const previewedModel = searchParams.get('preview');
4
- const previewedId = searchParams.get('overrides.' + previewedModel);
5
- if (!previewedId) {
6
- logger.warn('No previewed ID found in search params.');
7
- }
8
- return previewedId;
9
- };
1
+ "use strict";
@@ -3,13 +3,4 @@
3
3
  *
4
4
  * Note: This logic is only used by the NextJS SDK.
5
5
  */
6
- import { LRUCache } from 'lru-cache';
7
- export function init() {
8
- if (!globalThis._BUILDER_PREVIEW_LRU_CACHE) {
9
- globalThis._BUILDER_PREVIEW_LRU_CACHE = new LRUCache({
10
- max: 500,
11
- // how long to live in ms
12
- ttl: 1000 * 60 * 5
13
- });
14
- }
15
- }
6
+ export function init() { }
@@ -1,8 +1,4 @@
1
- 'use server';
2
- import { init } from './init';
3
1
  export async function postPreviewContent({ key, value }) {
4
- init();
5
- globalThis._BUILDER_PREVIEW_LRU_CACHE.set(key, value);
6
2
  return {
7
3
  [key]: value
8
4
  };
@@ -1,12 +0,0 @@
1
- /**
2
- * This is an LRU cache to hold preview content on the server-side.
3
- *
4
- * Note: This logic is only used by the NextJS SDK.
5
- */
6
- import type { LRUCache } from 'lru-cache';
7
- import type { BuilderContent } from '../../types/builder-content';
8
- type BuilderLRUCache = LRUCache<string, BuilderContent>;
9
- export type GlobalWCache = typeof globalThis & {
10
- _BUILDER_PREVIEW_LRU_CACHE: BuilderLRUCache;
11
- };
12
- export {};
@@ -1,6 +1 @@
1
- /**
2
- * This is an LRU cache to hold preview content on the server-side.
3
- *
4
- * Note: This logic is only used by the NextJS SDK.
5
- */
6
- export {};
1
+ "use strict";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -1,8 +1,4 @@
1
- import { getIdFromSearchParams } from './helpers';
2
- import { init } from './init';
3
- import type { GlobalWCache } from './types';
4
- export function getPreviewContent(searchParams: URLSearchParams) {
5
- init();
6
- const id = getIdFromSearchParams(searchParams);
7
- return typeof id === 'string' ? (globalThis as GlobalWCache)._BUILDER_PREVIEW_LRU_CACHE.get(id) : undefined;
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ export function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined {
3
+ return undefined;
8
4
  }
@@ -1,9 +0,0 @@
1
- import { logger } from '../logger';
2
- export const getIdFromSearchParams = (searchParams: URLSearchParams) => {
3
- const previewedModel = searchParams.get('preview');
4
- const previewedId = searchParams.get('overrides.' + previewedModel);
5
- if (!previewedId) {
6
- logger.warn('No previewed ID found in search params.');
7
- }
8
- return previewedId;
9
- }
@@ -4,14 +4,4 @@
4
4
  * Note: This logic is only used by the NextJS SDK.
5
5
  */
6
6
 
7
- import { LRUCache } from 'lru-cache';
8
- import type { GlobalWCache } from './types';
9
- export function init() {
10
- if (!(globalThis as GlobalWCache)._BUILDER_PREVIEW_LRU_CACHE) {
11
- (globalThis as GlobalWCache)._BUILDER_PREVIEW_LRU_CACHE = new LRUCache({
12
- max: 500,
13
- // how long to live in ms
14
- ttl: 1000 * 60 * 5
15
- });
16
- }
17
- }
7
+ export function init() {}
@@ -1,8 +1,4 @@
1
- 'use server';
2
-
3
1
  import type { BuilderContent } from '../../types/builder-content';
4
- import { init } from './init';
5
- import type { GlobalWCache } from './types';
6
2
  export async function postPreviewContent({
7
3
  key,
8
4
  value
@@ -10,8 +6,6 @@ export async function postPreviewContent({
10
6
  key: string;
11
7
  value: BuilderContent;
12
8
  }) {
13
- init();
14
- (globalThis as GlobalWCache)._BUILDER_PREVIEW_LRU_CACHE.set(key, value);
15
9
  return {
16
10
  [key]: value
17
11
  };
@@ -1,12 +0,0 @@
1
- /**
2
- * This is an LRU cache to hold preview content on the server-side.
3
- *
4
- * Note: This logic is only used by the NextJS SDK.
5
- */
6
-
7
- import type { LRUCache } from 'lru-cache';
8
- import type { BuilderContent } from '../../types/builder-content';
9
- type BuilderLRUCache = LRUCache<string, BuilderContent>;
10
- export type GlobalWCache = typeof globalThis & {
11
- _BUILDER_PREVIEW_LRU_CACHE: BuilderLRUCache;
12
- }