@remix-run/node
Advanced tools
Comparing version 0.0.0-nightly-bd289fa-20230822 to 0.0.0-nightly-bd4f87355-20240628
/** | ||
* @remix-run/node v0.0.0-nightly-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -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; | ||
@@ -22,3 +18,8 @@ Headers: typeof Headers; | ||
} | ||
interface RequestInit { | ||
duplex?: "half"; | ||
} | ||
} | ||
export declare function installGlobals(): void; | ||
export declare function installGlobals({ nativeFetch, }?: { | ||
nativeFetch?: boolean; | ||
}): void; |
/** | ||
* @remix-run/node v0.0.0-nightly-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -15,22 +15,38 @@ * Copyright (c) Remix Software Inc. | ||
var webStream = require('@remix-run/web-stream'); | ||
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; | ||
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-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
@@ -1,3 +0,1 @@ | ||
export type { HeadersInit, RequestInfo, RequestInit, ResponseInit, } from "./fetch"; | ||
export { fetch, FormData, Headers, Request, Response } from "./fetch"; | ||
export { installGlobals } from "./globals"; | ||
@@ -8,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, redirectDocument, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime"; | ||
export type { ActionArgs, ActionFunction, AppData, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderArgs, LoaderFunction, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, HandleErrorFunction, PageLinkDescriptor, RequestHandler, RouteHandle, 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"; | ||
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-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -15,3 +15,2 @@ * Copyright (c) Remix Software Inc. | ||
var fetch = require('./fetch.js'); | ||
var globals = require('./globals.js'); | ||
@@ -23,9 +22,5 @@ var fileStorage = require('./sessions/fileStorage.js'); | ||
var serverRuntime = require('@remix-run/server-runtime'); | ||
var webFetch = require('@remix-run/web-fetch'); | ||
exports.Request = fetch.Request; | ||
exports.Response = fetch.Response; | ||
exports.fetch = fetch.fetch; | ||
exports.installGlobals = globals.installGlobals; | ||
@@ -95,13 +90,13 @@ exports.createFileSessionStorage = fileStorage.createFileSessionStorage; | ||
}); | ||
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-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -61,5 +61,5 @@ * Copyright (c) Remix Software Inc. | ||
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 | ||
@@ -137,1 +137,2 @@ // than the maximum number of files allowed on an NTFS or ext4 volume | ||
exports.createFileSessionStorage = createFileSessionStorage; | ||
exports.getFile = getFile; |
/** | ||
* @remix-run/node v0.0.0-nightly-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -19,22 +19,18 @@ * Copyright (c) Remix Software Inc. | ||
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); | ||
@@ -75,0 +70,0 @@ } |
/** | ||
* @remix-run/node v0.0.0-nightly-bd289fa-20230822 | ||
* @remix-run/node v0.0.0-nightly-bd4f87355-20240628 | ||
* | ||
@@ -173,3 +173,2 @@ * Copyright (c) Remix Software Inc. | ||
} | ||
async arrayBuffer() { | ||
@@ -176,0 +175,0 @@ let stream = node_fs.createReadStream(this.filepath); |
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-bd289fa-20230822", | ||
"version": "0.0.0-nightly-bd4f87355-20240628", | ||
"description": "Node.js platform abstractions for Remix", | ||
@@ -20,10 +20,9 @@ "bugs": { | ||
"dependencies": { | ||
"@remix-run/server-runtime": "0.0.0-nightly-bd289fa-20230822", | ||
"@remix-run/web-fetch": "^4.3.7", | ||
"@remix-run/web-file": "^3.0.3", | ||
"@remix-run/web-stream": "^1.0.4", | ||
"@remix-run/server-runtime": "0.0.0-nightly-bd4f87355-20240628", | ||
"@remix-run/web-fetch": "^4.4.2", | ||
"@web3-storage/multipart-parser": "^1.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" | ||
}, | ||
@@ -54,3 +53,6 @@ "devDependencies": { | ||
"README.md" | ||
] | ||
} | ||
], | ||
"scripts": { | ||
"tsc": "tsc" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
8
0
30995
20
805
+ Addedundici@^6.11.1
+ Added@remix-run/router@0.0.0-experimental-078ef8de9(transitive)
+ Added@remix-run/server-runtime@0.0.0-nightly-bd4f87355-20240628(transitive)
+ Added@types/cookie@0.6.0(transitive)
+ Addedcookie@0.6.0(transitive)
+ Addedturbo-stream@2.2.0(transitive)
+ Addedundici@6.21.0(transitive)
- Removed@remix-run/web-file@^3.0.3
- Removed@remix-run/web-stream@^1.0.4
- Removed@remix-run/router@0.0.0-experimental-ad6954b7(transitive)
- Removed@remix-run/server-runtime@0.0.0-nightly-bd289fa-20230822(transitive)
- Removed@types/cookie@0.4.1(transitive)
- Removedcookie@0.4.2(transitive)
- Removedtype-fest@4.30.0(transitive)
Updated@remix-run/server-runtime@0.0.0-nightly-bd4f87355-20240628
Updated@remix-run/web-fetch@^4.4.2