@react-router/node
Advanced tools
@@ -0,1 +1,3 @@ | ||
| /// <reference types="node" /> | ||
| import { webcrypto as nodeWebCrypto } from "node:crypto"; | ||
| declare global { | ||
@@ -15,2 +17,3 @@ namespace NodeJS { | ||
| WritableStream: typeof WritableStream; | ||
| crypto: typeof nodeWebCrypto; | ||
| } | ||
@@ -17,0 +20,0 @@ } |
+6
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -16,2 +16,3 @@ * Copyright (c) Remix Software Inc. | ||
| var undici = require('undici'); | ||
| var node_crypto = require('node:crypto'); | ||
@@ -30,4 +31,8 @@ function installGlobals() { | ||
| global.FormData = undici.FormData; | ||
| if (!global.crypto) { | ||
| // @ts-expect-error - overriding globals | ||
| global.crypto = node_crypto.webcrypto; | ||
| } | ||
| } | ||
| exports.installGlobals = installGlobals; |
+6
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -12,2 +12,3 @@ * Copyright (c) Remix Software Inc. | ||
| import { File, Headers, Request, Response, fetch, FormData } from 'undici'; | ||
| import { webcrypto } from 'node:crypto'; | ||
@@ -26,4 +27,8 @@ function installGlobals() { | ||
| global.FormData = FormData; | ||
| if (!global.crypto) { | ||
| // @ts-expect-error - overriding globals | ||
| global.crypto = webcrypto; | ||
| } | ||
| } | ||
| export { installGlobals }; |
+0
-1
| export { installGlobals } from "./globals"; | ||
| export { createFileSessionStorage } from "./sessions/fileStorage"; | ||
| export { createFileUploadHandler as unstable_createFileUploadHandler, NodeOnDiskFile, } from "./upload/fileUploadHandler"; | ||
| export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSessionStorage, } from "./implementations"; | ||
| export { createReadableStreamFromReadable, readableStreamToString, writeAsyncIterableToWritable, writeReadableStreamToWritable, } from "./stream"; |
+1
-6
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -18,3 +18,2 @@ * Copyright (c) Remix Software Inc. | ||
| var fileUploadHandler = require('./upload/fileUploadHandler.js'); | ||
| var implementations = require('./implementations.js'); | ||
| var stream = require('./stream.js'); | ||
@@ -28,6 +27,2 @@ | ||
| exports.unstable_createFileUploadHandler = fileUploadHandler.createFileUploadHandler; | ||
| exports.createCookie = implementations.createCookie; | ||
| exports.createCookieSessionStorage = implementations.createCookieSessionStorage; | ||
| exports.createMemorySessionStorage = implementations.createMemorySessionStorage; | ||
| exports.createSessionStorage = implementations.createSessionStorage; | ||
| exports.createReadableStreamFromReadable = stream.createReadableStreamFromReadable; | ||
@@ -34,0 +29,0 @@ exports.readableStreamToString = stream.readableStreamToString; |
+1
-2
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -14,3 +14,2 @@ * Copyright (c) Remix Software Inc. | ||
| export { NodeOnDiskFile, createFileUploadHandler as unstable_createFileUploadHandler } from './upload/fileUploadHandler.mjs'; | ||
| export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSessionStorage } from './implementations.mjs'; | ||
| export { createReadableStreamFromReadable, readableStreamToString, writeAsyncIterableToWritable, writeReadableStreamToWritable } from './stream.mjs'; |
+1
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -15,6 +15,5 @@ * Copyright (c) Remix Software Inc. | ||
| var crypto = require('node:crypto'); | ||
| var node_fs = require('node:fs'); | ||
| var path = require('node:path'); | ||
| var implementations = require('../implementations.js'); | ||
| var reactRouter = require('react-router'); | ||
@@ -39,3 +38,2 @@ function _interopNamespace(e) { | ||
| var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto); | ||
| var path__namespace = /*#__PURE__*/_interopNamespace(path); | ||
@@ -55,3 +53,3 @@ | ||
| }) { | ||
| return implementations.createSessionStorage({ | ||
| return reactRouter.createSessionStorage({ | ||
| cookie, | ||
@@ -64,5 +62,3 @@ async createData(data, expires) { | ||
| while (true) { | ||
| // 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)); | ||
| let randomBytes = crypto.getRandomValues(new Uint8Array(8)); | ||
| // This storage manages an id space of 2^64 ids, which is far greater | ||
@@ -69,0 +65,0 @@ // than the maximum number of files allowed on an NTFS or ext4 volume |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -11,6 +11,5 @@ * Copyright (c) Remix Software Inc. | ||
| */ | ||
| import * as crypto from 'node:crypto'; | ||
| import { promises } from 'node:fs'; | ||
| import * as path from 'node:path'; | ||
| import { createSessionStorage } from '../implementations.mjs'; | ||
| import { createSessionStorage } from 'react-router'; | ||
@@ -37,5 +36,3 @@ /** | ||
| while (true) { | ||
| // TODO: Once Node v19 is supported we should use the globally provided | ||
| // Web Crypto API's crypto.getRandomValues() function here instead. | ||
| let randomBytes = crypto.webcrypto.getRandomValues(new Uint8Array(8)); | ||
| let randomBytes = crypto.getRandomValues(new Uint8Array(8)); | ||
| // This storage manages an id space of 2^64 ids, which is far greater | ||
@@ -42,0 +39,0 @@ // than the maximum number of files allowed on an NTFS or ext4 volume |
+1
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -15,3 +15,3 @@ * Copyright (c) Remix Software Inc. | ||
| var crypto = require('node:crypto'); | ||
| var node_crypto = require('node:crypto'); | ||
| var node_fs = require('node:fs'); | ||
@@ -56,3 +56,3 @@ var promises = require('node:fs/promises'); | ||
| let ext = filename ? path.extname(filename) : ""; | ||
| return "upload_" + crypto.randomBytes(4).readUInt32LE(0) + ext; | ||
| return "upload_" + node_crypto.randomBytes(4).readUInt32LE(0) + ext; | ||
| }; | ||
@@ -59,0 +59,0 @@ async function uniqueFile(filepath) { |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * @react-router/node v0.0.0-nightly-bf7ecb711-20240911 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+3
-5
| { | ||
| "name": "@react-router/node", | ||
| "version": "0.0.0-nightly-bf23aaf61-20240802", | ||
| "version": "0.0.0-nightly-bf7ecb711-20240911", | ||
| "description": "Node.js platform abstractions for React Router", | ||
@@ -35,3 +35,2 @@ "bugs": { | ||
| "@web3-storage/multipart-parser": "^1.0.0", | ||
| "cookie-signature": "^1.1.0", | ||
| "source-map-support": "^0.5.21", | ||
@@ -42,10 +41,9 @@ "stream-slice": "^0.1.2", | ||
| "devDependencies": { | ||
| "@types/cookie-signature": "^1.0.3", | ||
| "@types/source-map-support": "^0.5.4", | ||
| "typescript": "^5.1.6", | ||
| "react-router": "0.0.0-nightly-bf23aaf61-20240802" | ||
| "react-router": "0.0.0-nightly-bf7ecb711-20240911" | ||
| }, | ||
| "peerDependencies": { | ||
| "typescript": "^5.1.0", | ||
| "react-router": "0.0.0-nightly-bf23aaf61-20240802" | ||
| "react-router": "0.0.0-nightly-bf7ecb711-20240911" | ||
| }, | ||
@@ -52,0 +50,0 @@ "peerDependenciesMeta": { |
| import type { SignFunction, UnsignFunction } from "react-router"; | ||
| export declare const sign: SignFunction; | ||
| export declare const unsign: UnsignFunction; |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| var cookieSignature = require('cookie-signature'); | ||
| function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
| var cookieSignature__default = /*#__PURE__*/_interopDefaultLegacy(cookieSignature); | ||
| const sign = async (value, secret) => { | ||
| return cookieSignature__default["default"].sign(value, secret); | ||
| }; | ||
| const unsign = async (signed, secret) => { | ||
| return cookieSignature__default["default"].unsign(signed, secret); | ||
| }; | ||
| exports.sign = sign; | ||
| exports.unsign = unsign; |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| import cookieSignature from 'cookie-signature'; | ||
| const sign = async (value, secret) => { | ||
| return cookieSignature.sign(value, secret); | ||
| }; | ||
| const unsign = async (signed, secret) => { | ||
| return cookieSignature.unsign(signed, secret); | ||
| }; | ||
| export { sign, unsign }; |
| export declare const createCookie: import("react-router").CreateCookieFunction; | ||
| export declare const createCookieSessionStorage: import("react-router").CreateCookieSessionStorageFunction; | ||
| export declare const createSessionStorage: import("react-router").CreateSessionStorageFunction; | ||
| export declare const createMemorySessionStorage: import("react-router").CreateMemorySessionStorageFunction; |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| var reactRouter = require('react-router'); | ||
| var crypto = require('./crypto.js'); | ||
| const createCookie = reactRouter.createCookieFactory({ | ||
| sign: crypto.sign, | ||
| unsign: crypto.unsign | ||
| }); | ||
| const createCookieSessionStorage = reactRouter.createCookieSessionStorageFactory(createCookie); | ||
| const createSessionStorage = reactRouter.createSessionStorageFactory(createCookie); | ||
| const createMemorySessionStorage = reactRouter.createMemorySessionStorageFactory(createSessionStorage); | ||
| exports.createCookie = createCookie; | ||
| exports.createCookieSessionStorage = createCookieSessionStorage; | ||
| exports.createMemorySessionStorage = createMemorySessionStorage; | ||
| exports.createSessionStorage = createSessionStorage; |
| /** | ||
| * @react-router/node v0.0.0-nightly-bf23aaf61-20240802 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| import { createCookieFactory, createCookieSessionStorageFactory, createSessionStorageFactory, createMemorySessionStorageFactory } from 'react-router'; | ||
| import { sign, unsign } from './crypto.mjs'; | ||
| const createCookie = createCookieFactory({ | ||
| sign, | ||
| unsign | ||
| }); | ||
| const createCookieSessionStorage = createCookieSessionStorageFactory(createCookie); | ||
| const createSessionStorage = createSessionStorageFactory(createCookie); | ||
| const createMemorySessionStorage = createMemorySessionStorageFactory(createSessionStorage); | ||
| export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSessionStorage }; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
6
-14.29%3
-25%0
-100%55811
-7.54%22
-21.43%1131
-7.67%+ Added
+ Added
- Removed
- Removed
- Removed
- Removed