@fastly/compute-js-static-publish
Advanced tools
Comparing version 2.3.0-alpha.0 to 2.3.0-alpha.1
@@ -153,3 +153,3 @@ // This program builds static resources out of the files in the | ||
else { | ||
content = 'file' + index; | ||
content = 'String(file' + index + ')'; | ||
} | ||
@@ -202,4 +202,5 @@ let module; | ||
fileContents += `\nexport const autoExt = ${JSON.stringify(autoExt)};\n`; | ||
fileContents += '\nexport const staticAssets = new StaticAssets(assets);\n'; | ||
fs.writeFileSync('./src/statics.js', fileContents); | ||
console.log("✅ Wrote static file loader for " + files.length + " file(s)."); | ||
} |
@@ -6,4 +6,5 @@ /// <reference types="@fastly/js-compute" /> | ||
constructor(assetsMap: AssetsMap); | ||
getAsset(key: string): import("./types.js").Asset; | ||
serveAsset(event: FetchEvent, pathPrefix?: string): Response | null; | ||
} | ||
//# sourceMappingURL=static-assets.d.ts.map |
@@ -5,6 +5,9 @@ export class StaticAssets { | ||
} | ||
getAsset(key) { | ||
return this.assetsMap[key]; | ||
} | ||
serveAsset(event, pathPrefix = '') { | ||
const { request } = event; | ||
const { pathname } = new URL(request.url); | ||
const asset = this.assetsMap[`${pathPrefix}${pathname}`]; | ||
const asset = this.getAsset(`${pathPrefix}${pathname}`); | ||
if (!asset) { | ||
@@ -11,0 +14,0 @@ return null; |
{ | ||
"name": "@fastly/compute-js-static-publish", | ||
"type": "module", | ||
"version": "2.3.0-alpha.0", | ||
"version": "2.3.0-alpha.1", | ||
"description": "Static Publisher for Compute@Edge JavaScript", | ||
@@ -6,0 +6,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
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
58182
1114