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

@stackbit/sdk

Package Overview
Dependencies
Maintainers
13
Versions
424
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackbit/sdk - npm Package Compare versions

Comparing version 0.2.37 to 0.2.38

1

dist/config/config-loader.js

@@ -719,2 +719,3 @@ "use strict";

'contentModels',
'presetSource',
'modelsSource',

@@ -721,0 +722,0 @@ 'models',

@@ -222,2 +222,13 @@ "use strict";

});
const presetSourceFilesSchema = joi_1.default.object({
type: joi_1.default.string().valid(joi_1.default.override, 'files').required(),
presetDirs: joi_1.default.array().items(joi_1.default.string()).required()
});
const presetSourceSchema = joi_1.default.object({
type: joi_1.default.string().valid('files').required()
}).when('.type', {
switch: [
{ is: 'files', then: presetSourceFilesSchema }
]
});
const modelsSourceFilesSchema = joi_1.default.object({

@@ -643,2 +654,3 @@ type: joi_1.default.string().valid(joi_1.default.override, 'files').required(),

contentModels: joi_1.default.any(),
presetSource: presetSourceSchema,
modelsSource: modelsSourceSchema,

@@ -645,0 +657,0 @@ models: modelsSchema

@@ -31,2 +31,3 @@ import { StricterUnion } from '../utils';

contentModels?: ContentModelMap;
presetSource?: PresetSource;
modelsSource?: ModelsSource;

@@ -76,2 +77,7 @@ }

}
export declare type PresetSource = PresetSourceFiles;
export interface PresetSourceFiles {
type: 'files';
presetDirs: string[];
}
export declare type ModelsSource = ModelsSourceFiles | ModelsSourceContentful | ModelsSourceSanity;

@@ -78,0 +84,0 @@ export interface ModelsSourceFiles {

@@ -13,4 +13,8 @@ "use strict";

async function loadPresets(dirPath, config) {
var _a, _b;
const presetFiles = [];
const presetsRelDirs = ['.stackbit/presets', 'node_modules/@stackbit/components/presets'];
let presetsRelDirs = ['.stackbit/presets', 'node_modules/@stackbit/components/presets'];
if (((_a = config.presetSource) === null || _a === void 0 ? void 0 : _a.type) === 'files' && ((_b = config.presetSource) === null || _b === void 0 ? void 0 : _b.presetDirs)) {
presetsRelDirs = [...new Set([...presetsRelDirs, ...config.presetSource.presetDirs])];
}
for (const presetsRelDir of presetsRelDirs) {

@@ -17,0 +21,0 @@ const presetsDir = path_1.default.join(dirPath, presetsRelDir);

4

package.json
{
"name": "@stackbit/sdk",
"version": "0.2.37",
"version": "0.2.38",
"description": "Stackbit SDK",

@@ -68,3 +68,3 @@ "main": "dist/index.js",

},
"gitHead": "2102ed599336f5b42c03e91636176d7e79b3fdde"
"gitHead": "00aed1ebdcb433c5251ff62fb43cf32b887b82ae"
}

@@ -835,2 +835,3 @@ import path from 'path';

'contentModels',
'presetSource',
'modelsSource',

@@ -837,0 +838,0 @@ 'models',

@@ -12,2 +12,4 @@ import Joi from 'joi';

ModelsSource,
PresetSource,
PresetSourceFiles,
SanityImport,

@@ -257,2 +259,15 @@ YamlBaseModel,

const presetSourceFilesSchema = Joi.object<PresetSourceFiles>({
type: Joi.string().valid(Joi.override, 'files').required(),
presetDirs: Joi.array().items(Joi.string()).required()
});
const presetSourceSchema = Joi.object<PresetSource>({
type: Joi.string().valid('files').required()
}).when('.type', {
switch: [
{ is: 'files', then: presetSourceFilesSchema }
]
});
const modelsSourceFilesSchema = Joi.object<ModelsSourceFiles>({

@@ -731,2 +746,3 @@ type: Joi.string().valid(Joi.override, 'files').required(),

contentModels: Joi.any(), // contentModels should have been already validated by now
presetSource: presetSourceSchema,
modelsSource: modelsSourceSchema,

@@ -733,0 +749,0 @@ models: modelsSchema

@@ -34,2 +34,3 @@ import { StricterUnion } from '../utils';

contentModels?: ContentModelMap;
presetSource?: PresetSource;
modelsSource?: ModelsSource;

@@ -89,2 +90,9 @@ }

export type PresetSource = PresetSourceFiles;
export interface PresetSourceFiles {
type: 'files';
presetDirs: string[];
}
export type ModelsSource = ModelsSourceFiles | ModelsSourceContentful | ModelsSourceSanity;

@@ -91,0 +99,0 @@

@@ -16,4 +16,8 @@ import _ from 'lodash';

const presetFiles = [];
const presetsRelDirs = ['.stackbit/presets', 'node_modules/@stackbit/components/presets'];
let presetsRelDirs = ['.stackbit/presets', 'node_modules/@stackbit/components/presets'];
if (config.presetSource?.type === 'files' && config.presetSource?.presetDirs) {
presetsRelDirs = [...new Set([...presetsRelDirs, ...config.presetSource.presetDirs])];
}
for (const presetsRelDir of presetsRelDirs) {

@@ -20,0 +24,0 @@ const presetsDir = path.join(dirPath, presetsRelDir);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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