@miniflare/shared
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
@@ -233,2 +233,4 @@ import { Awaitable as Awaitable_2 } from '@miniflare/shared'; | ||
export declare function resolveStoragePersist(rootPath: string, persist?: boolean | string): boolean | string | undefined; | ||
/** | ||
@@ -235,0 +237,0 @@ * Runs closure with the context's input gate (if any) closed, unless |
@@ -102,2 +102,11 @@ // packages/shared/src/compat.ts | ||
} | ||
var urlRegexp = /^([a-z]+:)?\/\//i; | ||
function resolveStoragePersist(rootPath, persist) { | ||
if (typeof persist === "string") { | ||
if (urlRegexp.test(persist)) | ||
return persist; | ||
return path.resolve(rootPath, persist); | ||
} | ||
return persist; | ||
} | ||
var namespaceRegexp = /[/\\:|]/g; | ||
@@ -107,2 +116,3 @@ var dotRegexp = /(^|\/|\\)(\.+)(\/|\\|$)/g; | ||
var windowsReservedRegexp = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; | ||
var leadingRegexp = /^[ /\\]+/; | ||
var trailingRegexp = /[ /\\]+$/; | ||
@@ -112,7 +122,7 @@ function dotReplacement(match, g1, g2, g3) { | ||
} | ||
function trailingReplacement(match) { | ||
function underscoreReplacement(match) { | ||
return "".padStart(match.length, "_"); | ||
} | ||
function sanitisePath(unsafe) { | ||
return unsafe.replace(namespaceRegexp, path.sep).replace(dotRegexp, dotReplacement).replace(dotRegexp, dotReplacement).replace(illegalRegexp, "_").replace(windowsReservedRegexp, "_").replace(trailingRegexp, trailingReplacement).substring(0, 255); | ||
return unsafe.replace(namespaceRegexp, path.sep).replace(dotRegexp, dotReplacement).replace(dotRegexp, dotReplacement).replace(illegalRegexp, "_").replace(windowsReservedRegexp, "_").replace(leadingRegexp, underscoreReplacement).replace(trailingRegexp, underscoreReplacement).substring(0, 255); | ||
} | ||
@@ -530,2 +540,3 @@ | ||
randomHex, | ||
resolveStoragePersist, | ||
runWithInputGateClosed, | ||
@@ -532,0 +543,0 @@ sanitisePath, |
{ | ||
"name": "@miniflare/shared", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"description": "Shared utility module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -43,4 +43,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@miniflare/shared-test": "2.0.0-rc.1" | ||
"@miniflare/shared-test": "2.0.0-rc.2" | ||
} | ||
} |
# `@miniflare/shared` | ||
Shared utility module for [Miniflare](https://github.com/cloudflare/miniflare): | ||
a fun, full-featured, fully-local simulator for Cloudflare Workers | ||
a fun, full-featured, fully-local simulator for Cloudflare Workers. |
Sorry, the diff of this file is not supported yet
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
42619
939