Socket
Socket
Sign inDemoInstall

@architect/asap

Package Overview
Dependencies
0
Maintainers
6
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.1-RC.0 to 4.0.1-RC.1

2

package.json
{
"name": "@architect/asap",
"version": "4.0.1-RC.0",
"version": "4.0.1-RC.1",
"description": "Architect Static Asset Proxy (ASAP) - a helpful library for Lambda-based static asset delivery",

@@ -5,0 +5,0 @@ "main": "src/asap.js",

@@ -18,2 +18,3 @@ let reader = require('./read')

* @param config.headers - object, map of custom response headers
* @param config.sandboxPath - string, local filesystem path for Sandbox static assets
* @param config.spa - boolean, forces index.html no matter the folder depth

@@ -93,3 +94,3 @@ *

let read = reader({ env: config.env })
let read = reader({ env: config.env, sandboxPath: config.sandboxPath })
return read({ Key, Bucket, IfNoneMatch, isFolder, config, rootPath })

@@ -96,0 +97,0 @@ }

@@ -27,2 +27,3 @@ let { existsSync, readFileSync } = require('fs')

let { Key, IfNoneMatch, isFolder, config } = params
// TODO: ARC_SANDBOX_PATH_TO_STATIC deprecated in Arc 4.1; retire in next breaking change
let { ARC_SANDBOX_PATH_TO_STATIC, ARC_STATIC_PREFIX, ARC_STATIC_FOLDER } = process.env

@@ -33,7 +34,7 @@ let headers = {}

// After 6.x we can rely on this env var in sandbox
let basePath = ARC_SANDBOX_PATH_TO_STATIC
let sandboxPath = config.sandboxPath || ARC_SANDBOX_PATH_TO_STATIC
// Unlike S3, handle basePath and assets inside the function as Sandbox is long-lived
// Unlike S3, handle sandboxPath and assets inside the function as Sandbox is long-lived
let staticAssets
let staticManifest = join(basePath, 'static.json')
let staticManifest = join(sandboxPath, 'static.json')
if (existsSync(staticManifest)) {

@@ -46,3 +47,3 @@ staticAssets = JSON.parse(readFileSync(staticManifest))

// Assume we're running from a lambda in src/**/* OR from vendored node_modules/@architect/sandbox
let filePath = join(basePath, Key)
let filePath = join(sandboxPath, Key)
// Denormalize static folder for local paths (not something we'd do in S3)

@@ -63,3 +64,3 @@ let staticPrefix = ARC_STATIC_PREFIX || ARC_STATIC_FOLDER

if (config.passthru) return null
return await pretty({ Key: filePath, config, isFolder })
return await pretty({ Key: filePath, config, isFolder, sandboxPath })
}

@@ -117,3 +118,3 @@

if (config.passthru) return null
return pretty({ Key: filePath, config, isFolder })
return pretty({ Key: filePath, config, isFolder, sandboxPath })
}

@@ -120,0 +121,0 @@ else {

@@ -12,4 +12,4 @@ let aws = require('aws-sdk')

module.exports = async function pretty (params) {
let { Bucket, Key, assets, headers, isFolder, prefix } = params
let { ARC_LOCAL, ARC_SANDBOX_PATH_TO_STATIC, NODE_ENV } = process.env
let { Bucket, Key, assets, headers, isFolder, prefix, sandboxPath } = params
let { ARC_LOCAL, NODE_ENV } = process.env
let local = NODE_ENV === 'testing' || ARC_LOCAL || params.env === 'testing'

@@ -29,5 +29,4 @@ let s3 = new aws.S3

async function getLocal (file) {
let basepath = ARC_SANDBOX_PATH_TO_STATIC
if (!file.startsWith(basepath)) {
file = join(basepath, file)
if (!file.startsWith(sandboxPath)) {
file = join(sandboxPath, file)
}

@@ -34,0 +33,0 @@ if (!existsSync(file)) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc