@astropub/assist
Advanced tools
Comparing version 0.1.1 to 0.1.2
// @ts-check | ||
import { Duplex, escape, getFileName, getFileExtension, getFileType, getHash, getReady, mkdir, pathToFileURL, withTrailingSlash, writeFile } from './utils.js' | ||
import { Duplex, escape, fetch, getFileName, getFileExtension, getFileType, getHash, getReady, mkdir, pathToFileURL, withTrailingSlash, writeFile } from './utils.js' | ||
@@ -5,0 +5,0 @@ /** @type {import('.').Assist} */ |
{ | ||
"name": "@astropub/assist", | ||
"description": "A library of tools to help you develop with Astro", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -5,9 +5,6 @@ import { createHash } from 'node:crypto' | ||
export { Duplex } from 'node:stream' | ||
export { fetch } from '@astropub/webapi' | ||
export const escape = (value) => new RegExp(value.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'), 'g') | ||
export const fetch = await (async () => { | ||
return globalThis.fetch || await import('@astropub/webapi').then(exports => exports.fetch) | ||
})() | ||
export const getFileName = (value) => String(String(value).split('/').pop() || '') || 'file.bin' | ||
@@ -362,2 +359,4 @@ | ||
{} | ||
) | ||
) | ||
/** @typedef {typeof globalThis.fetch} fetch */ |
21675