Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drizzle-builder

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drizzle-builder - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

55

dist/utils/context.js

@@ -8,12 +8,63 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; // TODO NOPE
var _object = require('./object');
var deepCollection = _object.deepCollection;
// TODO NOPE
var _shared = require('./shared');
var resourcePath = _shared.resourcePath;
var _path = require('path');
var path = _interopRequireDefault(_path).default;
var _ramda = require('ramda');
var pathSatisfies = _ramda.pathSatisfies;
var is = _ramda.is;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* This will return a relative URL prefix for a given resource (anything being
* output to an HTML file).
*
* The purpose of this to value is to be assigned to the `{{baseurl}}` template
* context property, for use in relative URLs within the HTML.
*
* This relative path is determined by the path-based ID of the resource (e.g.
* patterns.components.button) and the `dest` configration settings for the
* `resourceType` of the supplied resource (e.g. 'page', 'pattern').
*
* @param {Object} resource
* @param {Object} drizzleData
* @return {String}
*
* @example
* getBaseUrl(somePageResource, drizzleData);
* // '../..'
*/
function getBaseUrl(resource, drizzleData) {
var options = drizzleData.options;
var destRoot = options.dest.root;
var destResource = options.dest[Object.keys(options.keys).find(function (key) {
return options.keys[key].singular === resource.resourceType;
})];
var baseurl = path.relative(path.dirname(resourcePath(resource.id, destResource)), destRoot);
return baseurl === '' ? '.' + baseurl : baseurl;
}
function resourceContext(resource, drizzleData) {
var context = Object.assign({}, resource);
context.drizzle = drizzleData;
if (pathSatisfies(is(String), ['dest', 'root'], drizzleData.options)) {
context.baseurl = getBaseUrl(resource, drizzleData);
}
if (_typeof(resource.data) === 'object') {

@@ -20,0 +71,0 @@ Object.keys(resource.data).map(function (dataKey) {

2

package.json
{
"name": "drizzle-builder",
"version": "0.0.6",
"version": "0.0.7",
"description": "The builder for Drizzle",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc