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

remix-typedjson

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-typedjson - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

CHANGELOG.md
# CHANGELOG
## 🚀 v0.2.1
- 📦 Update peer dependency to support Remix v2
## 🚀 v0.2.0

@@ -4,0 +8,0 @@

2

dist/esm/index.d.ts

@@ -1,4 +0,4 @@

export { deserializeRemix, redirect, stringifyRemix, typeddefer, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export { deserializeRemix, redirect, stringifyRemix, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export type { RemixSerializedType, TypedFetcherWithComponents, TypedJsonResponse, TypedMetaFunction, UseDataFunctionReturn, } from './remix';
export { applyMeta, deserialize, parse, registerCustomType, serialize, stringify, } from './typedjson';
export type { MetaType, TypedJsonResult } from './typedjson';

@@ -1,2 +0,2 @@

export { deserializeRemix, redirect, stringifyRemix, typeddefer, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export { deserializeRemix, redirect, stringifyRemix, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export { applyMeta, deserialize, parse, registerCustomType, serialize, stringify, } from './typedjson';

@@ -6,3 +6,2 @@ import { HtmlMetaDescriptor, Params, type FetcherWithComponents } from '@remix-run/react';

typedjson(): Promise<T>;
typeddefer(): Promise<T>;
};

@@ -22,3 +21,2 @@ export interface AppLoadContext {

export declare const typedjson: TypedJsonFunction;
export declare const typeddefer: TypedJsonFunction;
export declare function useTypedLoaderData<T = AppData>(): UseDataFunctionReturn<T>;

@@ -25,0 +23,0 @@ export declare function useTypedActionData<T = AppData>(): UseDataFunctionReturn<T> | null;

import { useActionData, useFetcher, useLoaderData, useMatches, } from '@remix-run/react';
import { defer } from '@remix-run/server-runtime';
import * as _typedjson from './typedjson';

@@ -15,13 +14,2 @@ export const typedjson = (data, init = {}) => {

};
export const typeddefer = (data, init = {}) => {
// get meta
let { json, meta } = _typedjson.serialize(data);
console.log({ data, json, meta });
if (meta) {
;
data['__meta__'] = meta;
}
let responseInit = typeof init === 'number' ? { status: init } : init;
return defer(data, responseInit);
};
export function useTypedLoaderData() {

@@ -39,3 +27,2 @@ const data = useLoaderData();

const newData = deserializeRemix(fetcher.data);
// @ts-expect-error
fetcher.data = newData ?? undefined;

@@ -42,0 +29,0 @@ }

@@ -1,4 +0,4 @@

export { deserializeRemix, redirect, stringifyRemix, typeddefer, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export { deserializeRemix, redirect, stringifyRemix, typedjson, useTypedActionData, useTypedFetcher, useTypedLoaderData, useTypedRouteLoaderData, } from './remix';
export type { RemixSerializedType, TypedFetcherWithComponents, TypedJsonResponse, TypedMetaFunction, UseDataFunctionReturn, } from './remix';
export { applyMeta, deserialize, parse, registerCustomType, serialize, stringify, } from './typedjson';
export type { MetaType, TypedJsonResult } from './typedjson';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringify = exports.serialize = exports.registerCustomType = exports.parse = exports.deserialize = exports.applyMeta = exports.useTypedRouteLoaderData = exports.useTypedLoaderData = exports.useTypedFetcher = exports.useTypedActionData = exports.typedjson = exports.typeddefer = exports.stringifyRemix = exports.redirect = exports.deserializeRemix = void 0;
exports.stringify = exports.serialize = exports.registerCustomType = exports.parse = exports.deserialize = exports.applyMeta = exports.useTypedRouteLoaderData = exports.useTypedLoaderData = exports.useTypedFetcher = exports.useTypedActionData = exports.typedjson = exports.stringifyRemix = exports.redirect = exports.deserializeRemix = void 0;
var remix_1 = require("./remix");

@@ -8,3 +8,2 @@ Object.defineProperty(exports, "deserializeRemix", { enumerable: true, get: function () { return remix_1.deserializeRemix; } });

Object.defineProperty(exports, "stringifyRemix", { enumerable: true, get: function () { return remix_1.stringifyRemix; } });
Object.defineProperty(exports, "typeddefer", { enumerable: true, get: function () { return remix_1.typeddefer; } });
Object.defineProperty(exports, "typedjson", { enumerable: true, get: function () { return remix_1.typedjson; } });

@@ -11,0 +10,0 @@ Object.defineProperty(exports, "useTypedActionData", { enumerable: true, get: function () { return remix_1.useTypedActionData; } });

@@ -6,3 +6,2 @@ import { HtmlMetaDescriptor, Params, type FetcherWithComponents } from '@remix-run/react';

typedjson(): Promise<T>;
typeddefer(): Promise<T>;
};

@@ -22,3 +21,2 @@ export interface AppLoadContext {

export declare const typedjson: TypedJsonFunction;
export declare const typeddefer: TypedJsonFunction;
export declare function useTypedLoaderData<T = AppData>(): UseDataFunctionReturn<T>;

@@ -25,0 +23,0 @@ export declare function useTypedActionData<T = AppData>(): UseDataFunctionReturn<T> | null;

@@ -26,5 +26,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.redirect = exports.deserializeRemix = exports.stringifyRemix = exports.useTypedRouteLoaderData = exports.useTypedFetcher = exports.useTypedActionData = exports.useTypedLoaderData = exports.typeddefer = exports.typedjson = void 0;
exports.redirect = exports.deserializeRemix = exports.stringifyRemix = exports.useTypedRouteLoaderData = exports.useTypedFetcher = exports.useTypedActionData = exports.useTypedLoaderData = exports.typedjson = void 0;
const react_1 = require("@remix-run/react");
const server_runtime_1 = require("@remix-run/server-runtime");
const _typedjson = __importStar(require("./typedjson"));

@@ -43,14 +42,2 @@ const typedjson = (data, init = {}) => {

exports.typedjson = typedjson;
const typeddefer = (data, init = {}) => {
// get meta
let { json, meta } = _typedjson.serialize(data);
console.log({ data, json, meta });
if (meta) {
;
data['__meta__'] = meta;
}
let responseInit = typeof init === 'number' ? { status: init } : init;
return (0, server_runtime_1.defer)(data, responseInit);
};
exports.typeddefer = typeddefer;
function useTypedLoaderData() {

@@ -70,3 +57,2 @@ const data = (0, react_1.useLoaderData)();

const newData = deserializeRemix(fetcher.data);
// @ts-expect-error
fetcher.data = newData ?? undefined;

@@ -73,0 +59,0 @@ }

{
"name": "remix-typedjson",
"version": "0.2.0",
"version": "0.2.1",
"description": "This package is a replacement for superjson to use in your Remix app. It handles a subset of types that `superjson` supports, but is faster and smaller.",

@@ -65,3 +65,3 @@ "browser": "/dist/esm/index.js",

"peerDependencies": {
"@remix-run/react": "^1.16.0",
"@remix-run/react": "^1.16.0 || ^2.0",
"@remix-run/server-runtime": "^1.16.0",

@@ -68,0 +68,0 @@ "react": "^17.0.2 || ^18.0.0"

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