@netlify/blobs
Advanced tools
Comparing version
@@ -1,8 +0,42 @@ | ||
// src/main.ts | ||
import { createReadStream } from "fs"; | ||
import { stat } from "fs/promises"; | ||
import { Readable } from "stream"; | ||
import pMap from "p-map"; | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/retry.ts | ||
// src/main.mts | ||
var main_exports = {}; | ||
__export(main_exports, { | ||
Blobs: () => Blobs | ||
}); | ||
module.exports = __toCommonJS(main_exports); | ||
var import_node_fs = require("fs"); | ||
var import_promises = require("fs/promises"); | ||
var import_node_stream = require("stream"); | ||
var import_p_map = __toESM(require("p-map"), 1); | ||
// src/retry.mts | ||
var DEFAULT_RETRY_DELAY = 5e3; | ||
@@ -40,3 +74,3 @@ var MIN_RETRY_DELAY = 1e3; | ||
// src/main.ts | ||
// src/main.mts | ||
var EXPIRY_HEADER = "x-nf-expires-at"; | ||
@@ -170,4 +204,4 @@ var Blobs = class _Blobs { | ||
async setFile(key, path, { expiration } = {}) { | ||
const { size } = await stat(path); | ||
const file = Readable.toWeb(createReadStream(path)); | ||
const { size } = await (0, import_promises.stat)(path); | ||
const file = import_node_stream.Readable.toWeb((0, import_node_fs.createReadStream)(path)); | ||
const headers = { | ||
@@ -180,3 +214,3 @@ ..._Blobs.getExpirationHeaders(expiration), | ||
setFiles(files, { concurrency = 5 } = {}) { | ||
return pMap(files, ({ key, path, ...options }) => this.setFile(key, path, options), { concurrency }); | ||
return (0, import_p_map.default)(files, ({ key, path, ...options }) => this.setFile(key, path, options), { concurrency }); | ||
} | ||
@@ -192,4 +226,5 @@ async setJSON(key, data, { expiration } = {}) { | ||
}; | ||
export { | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Blobs | ||
}; | ||
}); |
{ | ||
"name": "@netlify/blobs", | ||
"version": "1.7.0-rc.7", | ||
"version": "1.7.0-rc.8", | ||
"description": "A JavaScript client for the Netlify Blob Store", | ||
"type": "module", | ||
"main": "./dist/main.cjs", | ||
"module": "./dist/main.js", | ||
"main": "./dist/main.js", | ||
"module": "./dist/main.mjs", | ||
"types": "./dist/main.d.ts", | ||
"exports": { | ||
"require": { | ||
"types": "./dist/main.d.cts", | ||
"path": "./dist/main.cjs" | ||
}, | ||
"import": { | ||
"types": "./dist/main.d.ts", | ||
"path": "./dist/main.js" | ||
}, | ||
"default": { | ||
"types": "./dist/main.d.ts", | ||
"path": "./dist/main.js" | ||
".": { | ||
"require": { | ||
"types": "./dist/main.d.ts", | ||
"path": "./dist/main.js" | ||
}, | ||
"import": { | ||
"types": "./dist/main.d.mts", | ||
"path": "./dist/main.mjs" | ||
}, | ||
"default": { | ||
"types": "./dist/main.d.mts", | ||
"path": "./dist/main.mjs" | ||
} | ||
} | ||
@@ -28,3 +29,3 @@ }, | ||
"prebuild": "rm -rf dist", | ||
"build": "tsup src/main.ts --d ./dist --format esm,cjs --dts --target es2021", | ||
"build": "tsup src/main.mts --d ./dist --format esm,cjs --dts --target es2021", | ||
"dev": "npm run build -- --watch", | ||
@@ -50,4 +51,4 @@ "prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/", | ||
"config": { | ||
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,scripts,.github}/**/*.{js,ts,md,html}\" \"*.{js,ts,md,html}\"", | ||
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,scripts,.github}/**/*.{js,ts,md,yml,json,html}\" \"*.{js,ts,yml,json,html}\" \".*.{js,ts,yml,json,html}\" \"!**/package-lock.json\" \"!package-lock.json\"" | ||
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,scripts,.github}/**/*.{js,mts,cts,ts,md,html}\" \"*.{js,mts,cts,ts,md,html}\"", | ||
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,scripts,.github}/**/*.{js,mts,cts,ts,md,yml,json,html}\" \"*.{js,mts,cts,ts,yml,json,html}\" \".*.{js,mts,cts,ts,yml,json,html}\" \"!**/package-lock.json\" \"!package-lock.json\"" | ||
}, | ||
@@ -54,0 +55,0 @@ "keywords": [], |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26410
0.27%1
Infinity%No
NaN