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

@remix-run/node

Package Overview
Dependencies
Maintainers
2
Versions
1030
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/node - npm Package Compare versions

Comparing version 0.0.0-nightly-d56574b-20230523 to 0.0.0-nightly-d58d4fbcc-20240711

2

dist/crypto.js
/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

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

import { atob, btoa } from "./base64";
declare global {

@@ -8,5 +7,2 @@ namespace NodeJS {

interface Global {
atob: typeof atob;
btoa: typeof btoa;
Blob: typeof Blob;
File: typeof File;

@@ -20,6 +16,10 @@ Headers: typeof Headers;

WritableStream: typeof WritableStream;
AbortController: typeof AbortController;
}
}
interface RequestInit {
duplex?: "half";
}
}
export declare function installGlobals(): void;
export declare function installGlobals({ nativeFetch, }?: {
nativeFetch?: boolean;
}): void;
/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -15,24 +15,38 @@ * Copyright (c) Remix Software Inc.

var webStream = require('@remix-run/web-stream');
var abortController = require('abort-controller');
var base64 = require('./base64.js');
var fetch = require('./fetch.js');
var webFile = require('@remix-run/web-file');
var webFetch = require('@remix-run/web-fetch');
function installGlobals() {
global.atob = base64.atob;
global.btoa = base64.btoa;
global.Blob = webFile.Blob;
global.File = webFile.File;
global.Headers = webFetch.Headers;
global.Request = fetch.Request;
global.Response = fetch.Response;
global.fetch = fetch.fetch;
global.FormData = webFetch.FormData;
global.ReadableStream = webStream.ReadableStream;
global.WritableStream = webStream.WritableStream;
global.AbortController = global.AbortController || abortController.AbortController;
function installGlobals({
nativeFetch
} = {}) {
if (nativeFetch) {
let {
File: UndiciFile,
fetch: undiciFetch,
FormData: UndiciFormData,
Headers: UndiciHeaders,
Request: UndiciRequest,
Response: UndiciResponse
} = require("undici");
global.File = UndiciFile;
global.Headers = UndiciHeaders;
global.Request = UndiciRequest;
global.Response = UndiciResponse;
global.fetch = undiciFetch;
global.FormData = UndiciFormData;
} else {
let {
File: RemixFile,
fetch: RemixFetch,
FormData: RemixFormData,
Headers: RemixHeaders,
Request: RemixRequest,
Response: RemixResponse
} = require("@remix-run/web-fetch");
global.File = RemixFile;
global.Headers = RemixHeaders;
global.Request = RemixRequest;
global.Response = RemixResponse;
global.fetch = RemixFetch;
global.FormData = RemixFormData;
}
}
exports.installGlobals = installGlobals;
/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

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

export { AbortController } from "abort-controller";
export type { HeadersInit, RequestInfo, RequestInit, ResponseInit, } from "./fetch";
export { fetch, FormData, Headers, Request, Response } from "./fetch";
export { installGlobals } from "./globals";

@@ -9,3 +6,3 @@ export { createFileSessionStorage } from "./sessions/fileStorage";

export { createReadableStreamFromReadable, readableStreamToString, writeAsyncIterableToWritable, writeReadableStreamToWritable, } from "./stream";
export { createRequestHandler, createSession, defer, broadcastDevReady, logDevReady, isCookie, isSession, json, MaxPartSizeExceededError, redirect, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
export type { ActionArgs, ActionFunction, AppData, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorBoundaryComponent, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, HtmlMetaDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderArgs, LoaderFunction, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, MetaDescriptor, MetaFunction, PageLinkDescriptor, RequestHandler, RouteComponent, RouteHandle, SerializeFrom, ServerBuild, ServerEntryModule, V2_ServerRuntimeMetaArgs as V2_MetaArgs, V2_ServerRuntimeMetaDescriptor as V2_MetaDescriptor, V2_ServerRuntimeMetaDescriptor as V2_HtmlMetaDescriptor, V2_ServerRuntimeMetaFunction as V2_MetaFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, } from "@remix-run/server-runtime";
export { createRequestHandler, createSession, unstable_defineLoader, unstable_defineAction, defer, broadcastDevReady, logDevReady, isCookie, isSession, json, MaxPartSizeExceededError, redirect, redirectDocument, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
export type { ActionFunction, ActionFunctionArgs, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorResponse, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderFunction, LoaderFunctionArgs, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, HandleErrorFunction, PageLinkDescriptor, RequestHandler, SerializeFrom, ServerBuild, ServerEntryModule, ServerRuntimeMetaArgs as MetaArgs, ServerRuntimeMetaDescriptor as MetaDescriptor, ServerRuntimeMetaFunction as MetaFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, } from "@remix-run/server-runtime";
/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -15,5 +15,2 @@ * Copyright (c) Remix Software Inc.

var sourceMapSupport = require('source-map-support');
var abortController = require('abort-controller');
var fetch = require('./fetch.js');
var globals = require('./globals.js');

@@ -25,17 +22,5 @@ var fileStorage = require('./sessions/fileStorage.js');

var serverRuntime = require('@remix-run/server-runtime');
var webFetch = require('@remix-run/web-fetch');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var sourceMapSupport__default = /*#__PURE__*/_interopDefaultLegacy(sourceMapSupport);
sourceMapSupport__default["default"].install();
Object.defineProperty(exports, 'AbortController', {
enumerable: true,
get: function () { return abortController.AbortController; }
});
exports.Request = fetch.Request;
exports.Response = fetch.Response;
exports.fetch = fetch.fetch;
exports.installGlobals = globals.installGlobals;

@@ -93,2 +78,6 @@ exports.createFileSessionStorage = fileStorage.createFileSessionStorage;

});
Object.defineProperty(exports, 'redirectDocument', {
enumerable: true,
get: function () { return serverRuntime.redirectDocument; }
});
Object.defineProperty(exports, 'unstable_composeUploadHandlers', {

@@ -102,13 +91,13 @@ enumerable: true,

});
Object.defineProperty(exports, 'unstable_parseMultipartFormData', {
Object.defineProperty(exports, 'unstable_defineAction', {
enumerable: true,
get: function () { return serverRuntime.unstable_parseMultipartFormData; }
get: function () { return serverRuntime.unstable_defineAction; }
});
Object.defineProperty(exports, 'FormData', {
Object.defineProperty(exports, 'unstable_defineLoader', {
enumerable: true,
get: function () { return webFetch.FormData; }
get: function () { return serverRuntime.unstable_defineLoader; }
});
Object.defineProperty(exports, 'Headers', {
Object.defineProperty(exports, 'unstable_parseMultipartFormData', {
enumerable: true,
get: function () { return webFetch.Headers; }
get: function () { return serverRuntime.unstable_parseMultipartFormData; }
});

@@ -22,2 +22,3 @@ import type { SessionStorage, SessionIdStorageStrategy, SessionData } from "@remix-run/server-runtime";

export declare function createFileSessionStorage<Data = SessionData, FlashData = Data>({ cookie, dir, }: FileSessionStorageOptions): SessionStorage<Data, FlashData>;
export declare function getFile(dir: string, id: string): string;
export {};
/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -15,5 +15,5 @@ * Copyright (c) Remix Software Inc.

var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var crypto = require('node:crypto');
var node_fs = require('node:fs');
var path = require('node:path');
var implementations = require('../implementations.js');

@@ -62,5 +62,5 @@

while (true) {
// TODO: Once node v16 is available on AWS we should use the webcrypto
// API's crypto.getRandomValues() function here instead.
let randomBytes = crypto__namespace.randomBytes(8);
// TODO: Once Node v19 is supported we should use the globally provided
// Web Crypto API's crypto.getRandomValues() function here instead.
let randomBytes = crypto__namespace.webcrypto.getRandomValues(new Uint8Array(8));
// This storage manages an id space of 2^64 ids, which is far greater

@@ -73,6 +73,6 @@ // than the maximum number of files allowed on an NTFS or ext4 volume

let file = getFile(dir, id);
await fs.promises.mkdir(path__namespace.dirname(file), {
await node_fs.promises.mkdir(path__namespace.dirname(file), {
recursive: true
});
await fs.promises.writeFile(file, content, {
await node_fs.promises.writeFile(file, content, {
encoding: "utf-8",

@@ -90,3 +90,3 @@ flag: "wx"

let file = getFile(dir, id);
let content = JSON.parse(await fs.promises.readFile(file, "utf-8"));
let content = JSON.parse(await node_fs.promises.readFile(file, "utf-8"));
let data = content.data;

@@ -99,3 +99,3 @@ let expires = typeof content.expires === "string" ? new Date(content.expires) : null;

// Remove expired session data.
if (expires) await fs.promises.unlink(file);
if (expires) await node_fs.promises.unlink(file);
return null;

@@ -113,6 +113,6 @@ } catch (error) {

let file = getFile(dir, id);
await fs.promises.mkdir(path__namespace.dirname(file), {
await node_fs.promises.mkdir(path__namespace.dirname(file), {
recursive: true
});
await fs.promises.writeFile(file, content, "utf-8");
await node_fs.promises.writeFile(file, content, "utf-8");
},

@@ -126,3 +126,3 @@ async deleteData(id) {

try {
await fs.promises.unlink(getFile(dir, id));
await node_fs.promises.unlink(getFile(dir, id));
} catch (error) {

@@ -143,1 +143,2 @@ if (error.code !== "ENOENT") throw error;

exports.createFileSessionStorage = createFileSessionStorage;
exports.getFile = getFile;
/// <reference types="node" />
/// <reference types="node" />
import type { Readable, Writable } from "stream";
import type { Readable, Writable } from "node:stream";
export declare function writeReadableStreamToWritable(stream: ReadableStream, writable: Writable): Promise<void>;

@@ -5,0 +5,0 @@ export declare function writeAsyncIterableToWritable(iterable: AsyncIterable<Uint8Array>, writable: Writable): Promise<void>;

/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -15,26 +15,22 @@ * Copyright (c) Remix Software Inc.

var stream = require('stream');
var node_stream = require('node:stream');
async function writeReadableStreamToWritable(stream, writable) {
let reader = stream.getReader();
async function read() {
let {
done,
value
} = await reader.read();
if (done) {
writable.end();
return;
let flushable = writable;
try {
while (true) {
let {
done,
value
} = await reader.read();
if (done) {
writable.end();
break;
}
writable.write(value);
if (typeof flushable.flush === "function") {
flushable.flush();
}
}
writable.write(value);
// If the stream is flushable, flush it to allow streaming to continue.
let flushable = writable;
if (typeof flushable.flush === "function") {
flushable.flush();
}
await read();
}
try {
await read();
} catch (error) {

@@ -59,3 +55,3 @@ writable.destroy(error);

let chunks = [];
async function read() {
while (true) {
let {

@@ -66,9 +62,8 @@ done,

if (done) {
return;
} else if (value) {
break;
}
if (value) {
chunks.push(value);
}
await read();
}
await read();
return Buffer.concat(chunks).toString(encoding);

@@ -82,6 +77,6 @@ }

class StreamPump {
constructor(stream$1) {
this.highWaterMark = stream$1.readableHighWaterMark || new stream.Stream.Readable().readableHighWaterMark;
constructor(stream) {
this.highWaterMark = stream.readableHighWaterMark || new node_stream.Stream.Readable().readableHighWaterMark;
this.accumalatedSize = 0;
this.stream = stream$1;
this.stream = stream;
this.enqueue = this.enqueue.bind(this);

@@ -88,0 +83,0 @@ this.error = this.error.bind(this);

@@ -47,3 +47,3 @@ /// <reference types="node" />

export declare function createFileUploadHandler({ directory, avoidFileConflicts, file, filter, maxPartSize, }?: FileUploadHandlerOptions): UploadHandler;
export declare class NodeOnDiskFile implements File {
export declare class NodeOnDiskFile implements Omit<File, "constructor"> {
private filepath;

@@ -55,2 +55,3 @@ type: string;

webkitRelativePath: string;
prototype: File;
constructor(filepath: string, type: string, slicer?: {

@@ -57,0 +58,0 @@ start: number;

/**
* @remix-run/node v0.0.0-nightly-d56574b-20230523
* @remix-run/node v0.0.0-nightly-d58d4fbcc-20240711
*

@@ -15,12 +15,12 @@ * Copyright (c) Remix Software Inc.

var crypto = require('crypto');
var fs = require('fs');
var promises = require('fs/promises');
var os = require('os');
var path = require('path');
var stream = require('stream');
var util = require('util');
var crypto = require('node:crypto');
var node_fs = require('node:fs');
var promises = require('node:fs/promises');
var node_os = require('node:os');
var path = require('node:path');
var node_stream = require('node:stream');
var node_util = require('node:util');
var serverRuntime = require('@remix-run/server-runtime');
var streamSlice = require('stream-slice');
var stream$1 = require('../stream.js');
var stream = require('../stream.js');

@@ -67,3 +67,3 @@ function _interopNamespace(e) {

function createFileUploadHandler({
directory = os.tmpdir(),
directory = node_os.tmpdir(),
avoidFileConflicts = true,

@@ -111,3 +111,3 @@ file = defaultFilePathResolver,

}).catch(() => {});
let writeFileStream = fs.createWriteStream(filepath);
let writeFileStream = node_fs.createWriteStream(filepath);
let size = 0;

@@ -126,3 +126,3 @@ let deleteFile = false;

writeFileStream.end();
await util.promisify(stream.finished)(writeFileStream);
await node_util.promisify(node_stream.finished)(writeFileStream);
if (deleteFile) {

@@ -132,8 +132,18 @@ await promises.rm(filepath).catch(() => {});

}
// TODO: remove this typecast once TS fixed File class regression
// https://github.com/microsoft/TypeScript/issues/52166
return new NodeOnDiskFile(filepath, contentType);
};
}
// TODO: remove this `Omit` usage once TS fixed File class regression
// https://github.com/microsoft/TypeScript/issues/52166
class NodeOnDiskFile {
lastModified = 0;
webkitRelativePath = "";
// TODO: remove this property once TS fixed File class regression
// https://github.com/microsoft/TypeScript/issues/52166
prototype = File.prototype;
constructor(filepath, type, slicer) {

@@ -146,3 +156,3 @@ this.filepath = filepath;

get size() {
let stats = fs.statSync(this.filepath);
let stats = node_fs.statSync(this.filepath);
if (this.slicer) {

@@ -164,6 +174,9 @@ let slice = this.slicer.end - this.slicer.start;

end
});
}
// TODO: remove this typecast once TS fixed File class regression
// https://github.com/microsoft/TypeScript/issues/52166
);
}
async arrayBuffer() {
let stream = fs.createReadStream(this.filepath);
let stream = node_fs.createReadStream(this.filepath);
if (this.slicer) {

@@ -180,10 +193,10 @@ stream = stream.pipe(streamSlice__namespace.slice(this.slicer.start, this.slicer.end));

stream() {
let stream = fs.createReadStream(this.filepath);
let stream$1 = node_fs.createReadStream(this.filepath);
if (this.slicer) {
stream = stream.pipe(streamSlice__namespace.slice(this.slicer.start, this.slicer.end));
stream$1 = stream$1.pipe(streamSlice__namespace.slice(this.slicer.start, this.slicer.end));
}
return stream$1.createReadableStreamFromReadable(stream);
return stream.createReadableStreamFromReadable(stream$1);
}
async text() {
return stream$1.readableStreamToString(this.stream());
return stream.readableStreamToString(this.stream());
}

@@ -190,0 +203,0 @@ get [Symbol.toStringTag]() {

MIT License
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023
Copyright (c) Shopify Inc. 2022-2024

@@ -6,0 +6,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "@remix-run/node",
"version": "0.0.0-nightly-d56574b-20230523",
"version": "0.0.0-nightly-d58d4fbcc-20240711",
"description": "Node.js platform abstractions for Remix",

@@ -20,18 +20,25 @@ "bugs": {

"dependencies": {
"@remix-run/server-runtime": "0.0.0-nightly-d56574b-20230523",
"@remix-run/web-fetch": "^4.3.4",
"@remix-run/web-file": "^3.0.2",
"@remix-run/web-stream": "^1.0.3",
"@remix-run/server-runtime": "0.0.0-nightly-d58d4fbcc-20240711",
"@remix-run/web-fetch": "^4.4.2",
"@web3-storage/multipart-parser": "^1.0.0",
"abort-controller": "^3.0.0",
"cookie-signature": "^1.1.0",
"source-map-support": "^0.5.21",
"stream-slice": "^0.1.2"
"stream-slice": "^0.1.2",
"undici": "^6.11.1"
},
"devDependencies": {
"@types/cookie-signature": "^1.0.3",
"@types/source-map-support": "^0.5.4"
"@types/source-map-support": "^0.5.4",
"typescript": "^5.1.6"
},
"peerDependencies": {
"typescript": "^5.1.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"engines": {
"node": ">=14"
"node": ">=18.0.0"
},

@@ -46,3 +53,6 @@ "files": [

"README.md"
]
}
],
"scripts": {
"tsc": "tsc"
}
}
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