@stackbit/sdk 0.3.3-alpha.0 → 0.3.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/analyze-schema-types.d.ts +10 -13
- package/dist/analyzer/analyze-schema-types.d.ts.map +1 -1
- package/dist/analyzer/analyze-schema-types.js.map +1 -1
- package/dist/analyzer/schema-generator.d.ts.map +1 -1
- package/dist/analyzer/schema-generator.js +6 -2
- package/dist/analyzer/schema-generator.js.map +1 -1
- package/dist/analyzer/site-analyzer.d.ts.map +1 -1
- package/dist/analyzer/site-analyzer.js.map +1 -1
- package/dist/config/config-consts.d.ts +1 -25
- package/dist/config/config-consts.d.ts.map +1 -1
- package/dist/config/config-consts.js +6 -79
- package/dist/config/config-consts.js.map +1 -1
- package/dist/config/config-loader-static.d.ts +3 -1
- package/dist/config/config-loader-static.d.ts.map +1 -1
- package/dist/config/config-loader-static.js +5 -1
- package/dist/config/config-loader-static.js.map +1 -1
- package/dist/config/config-loader-utils.d.ts +2 -1
- package/dist/config/config-loader-utils.d.ts.map +1 -1
- package/dist/config/config-loader-utils.js +4 -1
- package/dist/config/config-loader-utils.js.map +1 -1
- package/dist/config/config-loader.d.ts +2 -1
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-loader.js.map +1 -1
- package/dist/config/config-schema.d.ts +2 -2
- package/dist/config/config-schema.d.ts.map +1 -1
- package/dist/config/config-schema.js.map +1 -1
- package/dist/config/config-types.d.ts +44 -287
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/config/config-validator.d.ts +3 -2
- package/dist/config/config-validator.d.ts.map +1 -1
- package/dist/config/config-validator.js.map +1 -1
- package/dist/config/presets-loader.js +3 -0
- package/dist/config/presets-loader.js.map +1 -1
- package/dist/content/content-schema.js +1 -1
- package/dist/content/content-schema.js.map +1 -1
- package/dist/utils/model-extender.d.ts +3 -3
- package/dist/utils/model-extender.d.ts.map +1 -1
- package/dist/utils/model-extender.js +3 -3
- package/dist/utils/model-extender.js.map +1 -1
- package/dist/utils/model-iterators.d.ts +3 -67
- package/dist/utils/model-iterators.d.ts.map +1 -1
- package/dist/utils/model-iterators.js.map +1 -1
- package/dist/utils/model-matcher.js +1 -1
- package/dist/utils/model-matcher.js.map +1 -1
- package/dist/utils/model-utils.d.ts +8 -52
- package/dist/utils/model-utils.d.ts.map +1 -1
- package/dist/utils/model-utils.js +5 -1
- package/dist/utils/model-utils.js.map +1 -1
- package/package.json +4 -3
- package/src/analyzer/analyze-schema-types.ts +12 -16
- package/src/analyzer/schema-generator.ts +14 -4
- package/src/analyzer/site-analyzer.ts +2 -1
- package/src/config/config-consts.ts +1 -83
- package/src/config/config-loader-static.ts +11 -3
- package/src/config/config-loader-utils.ts +7 -3
- package/src/config/config-loader.ts +12 -11
- package/src/config/config-schema/style-field-schema.ts +1 -1
- package/src/config/config-schema.ts +20 -25
- package/src/config/config-types.ts +103 -334
- package/src/config/config-validator.ts +3 -2
- package/src/config/presets-loader.ts +3 -0
- package/src/content/content-schema.ts +1 -1
- package/src/utils/model-extender.ts +8 -8
- package/src/utils/model-iterators.ts +2 -2
- package/src/utils/model-matcher.ts +1 -1
- package/src/utils/model-utils.ts +25 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-utils.js","sourceRoot":"","sources":["../../src/utils/model-utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,2DAAsD;
|
|
1
|
+
{"version":3,"file":"model-utils.js","sourceRoot":"","sources":["../../src/utils/model-utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,2DAAsD;AA6BtD,SAAgB,cAAc,CAAC,MAAe,EAAE,SAAiB;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AAC5D,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,KAAY;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bit SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"homepage": "https://github.com/stackbit/stackbit-sdk#readme",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@octokit/rest": "^18.3.5",
|
|
40
|
-
"@stackbit/
|
|
40
|
+
"@stackbit/types": "^0.1.1-alpha.0",
|
|
41
|
+
"@stackbit/utils": "^0.2.10-alpha.1",
|
|
41
42
|
"acorn": "^8.2.4",
|
|
42
43
|
"chokidar": "^3.5.3",
|
|
43
44
|
"esbuild": "^0.14.42",
|
|
@@ -66,5 +67,5 @@
|
|
|
66
67
|
"ts-jest": "^26.5.1",
|
|
67
68
|
"typescript": "^4.2.2"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ce6cc18e1a564da92691413c1eed7a973cb6237f"
|
|
70
71
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
FieldCommonProps,
|
|
9
8
|
FieldType,
|
|
10
|
-
|
|
9
|
+
FieldCommonProps,
|
|
10
|
+
FieldBasicProps,
|
|
11
11
|
FieldEnumProps,
|
|
12
12
|
FieldImageProps,
|
|
13
13
|
FieldNumberProps,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
FieldReferenceProps,
|
|
17
17
|
FieldListProps,
|
|
18
18
|
FieldListItems
|
|
19
|
-
} from '
|
|
19
|
+
} from '@stackbit/types';
|
|
20
20
|
|
|
21
21
|
export type FieldWithUnknown =
|
|
22
22
|
| FieldUnknown
|
|
@@ -29,19 +29,15 @@ export type FieldWithUnknown =
|
|
|
29
29
|
| FieldReferenceWithUnknown
|
|
30
30
|
| FieldListWithUnknown;
|
|
31
31
|
|
|
32
|
-
export type FieldUnknown =
|
|
33
|
-
export type FieldSimpleWithUnknown =
|
|
34
|
-
export type FieldEnumWithUnknown =
|
|
35
|
-
export type FieldImageWithUnknown =
|
|
36
|
-
export type FieldNumberWithUnknown =
|
|
37
|
-
export type FieldObjectWithUnknown =
|
|
38
|
-
export type FieldModelWithUnknown =
|
|
39
|
-
export type FieldReferenceWithUnknown =
|
|
40
|
-
export type FieldListWithUnknown =
|
|
41
|
-
|
|
42
|
-
export type FieldCommonPropsWithUnknown = Omit<FieldCommonProps, 'type'> & {
|
|
43
|
-
type: FieldTypeWithUnknown;
|
|
44
|
-
};
|
|
32
|
+
export type FieldUnknown = FieldCommonProps & FieldUnknownProps;
|
|
33
|
+
export type FieldSimpleWithUnknown = FieldCommonProps & FieldBasicProps;
|
|
34
|
+
export type FieldEnumWithUnknown = FieldCommonProps & FieldEnumProps;
|
|
35
|
+
export type FieldImageWithUnknown = FieldCommonProps & FieldImageProps;
|
|
36
|
+
export type FieldNumberWithUnknown = FieldCommonProps & FieldNumberProps;
|
|
37
|
+
export type FieldObjectWithUnknown = FieldCommonProps & FieldObjectPropsWithUnknown;
|
|
38
|
+
export type FieldModelWithUnknown = FieldCommonProps & FieldModelProps;
|
|
39
|
+
export type FieldReferenceWithUnknown = FieldCommonProps & FieldReferenceProps;
|
|
40
|
+
export type FieldListWithUnknown = FieldCommonProps & FieldListPropsWithUnknown;
|
|
45
41
|
|
|
46
42
|
export type FieldTypeWithUnknown = 'unknown' | FieldType;
|
|
47
43
|
|
|
@@ -3,11 +3,12 @@ import _ from 'lodash';
|
|
|
3
3
|
import micromatch from 'micromatch';
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import { append, reducePromise } from '@stackbit/utils';
|
|
6
|
+
import { Field, FieldType, FieldListItems, FieldModelProps, FieldList } from '@stackbit/types';
|
|
6
7
|
|
|
7
8
|
import { FileBrowser, FileResult, getFileBrowserFromOptions, GetFileBrowserOptions } from './file-browser';
|
|
8
9
|
import { SSGMatchResult } from './ssg-matcher';
|
|
9
10
|
import { DATA_FILE_EXTENSIONS, EXCLUDED_DATA_FILES, EXCLUDED_MARKDOWN_FILES, EXCLUDED_COMMON_FILES, MARKDOWN_FILE_EXTENSIONS } from '../consts';
|
|
10
|
-
import { Model, ObjectModel, DataModel, PageModel,
|
|
11
|
+
import { Model, ObjectModel, DataModel, PageModel, YamlDataModel } from '../config/config-types';
|
|
11
12
|
import {
|
|
12
13
|
FieldListItemsWithUnknown,
|
|
13
14
|
FieldListPropsWithUnknown,
|
|
@@ -25,7 +26,12 @@ type StringFieldTypes = Exclude<FieldType, 'number' | 'boolean' | 'enum' | 'obje
|
|
|
25
26
|
type PartialObjectModel = Omit<ObjectModel, 'label' | 'fields'> & { fields: FieldWithUnknown[]; refFieldPaths?: FieldPath[]; refFields?: FieldModelProps[] };
|
|
26
27
|
type PartialPageModel = Omit<PageModel, 'label' | 'fields'> & { fields: FieldWithUnknown[]; filePaths: string[] };
|
|
27
28
|
type PartialPageModelWithFilePaths = Omit<PageModel, 'label'> & { filePaths: string[] };
|
|
28
|
-
type PartialDataModel = Omit<
|
|
29
|
+
type PartialDataModel = Omit<YamlDataModel, 'label' | 'fields' | 'items'> & {
|
|
30
|
+
name: string;
|
|
31
|
+
fields?: FieldWithUnknown[];
|
|
32
|
+
items?: FieldListItemsWithUnknown;
|
|
33
|
+
filePaths: string[];
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
const SAME_FOLDER_PAGE_DSC_COEFFICIENT = 0.6;
|
|
31
37
|
const ROOT_FOLDER_PAGE_DSC_COEFFICIENT = 0.7;
|
|
@@ -1258,11 +1264,15 @@ function removeUnknownTypesFromFields(fields: FieldWithUnknown[]): Field[] {
|
|
|
1258
1264
|
return accum.concat(Object.assign(field, { fields }));
|
|
1259
1265
|
}
|
|
1260
1266
|
case 'list': {
|
|
1261
|
-
const items =
|
|
1267
|
+
const { items: itemsWithUnknown } = field;
|
|
1268
|
+
if (!itemsWithUnknown) {
|
|
1269
|
+
return accum;
|
|
1270
|
+
}
|
|
1271
|
+
const items = removeUnknownTypesFromListItem(itemsWithUnknown!);
|
|
1262
1272
|
if (!items) {
|
|
1263
1273
|
return accum;
|
|
1264
1274
|
}
|
|
1265
|
-
return accum.concat(
|
|
1275
|
+
return accum.concat({ ...field, items } as FieldList);
|
|
1266
1276
|
}
|
|
1267
1277
|
default: {
|
|
1268
1278
|
return accum.concat(field);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import { Assets } from '@stackbit/types';
|
|
2
3
|
|
|
3
4
|
import { getFileBrowserFromOptions, GetFileBrowserOptions } from './file-browser';
|
|
4
5
|
import { matchSSG, SSGMatchResult } from './ssg-matcher';
|
|
5
6
|
import { CMSMatchResult, matchCMS } from './cms-matcher';
|
|
6
7
|
import { generateSchema, SchemaGeneratorResult } from './schema-generator';
|
|
7
|
-
import {
|
|
8
|
+
import { Config } from '../config/config-types';
|
|
8
9
|
|
|
9
10
|
export type SiteAnalyzerOptions = GetFileBrowserOptions;
|
|
10
11
|
|
|
@@ -1,83 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const SSG_NAMES = ['unibit', 'jekyll', 'hugo', 'gatsby', 'nextjs', 'custom', 'eleventy', 'vuepress', 'gridsome', 'nuxt', 'sapper', 'hexo'] as const;
|
|
3
|
-
|
|
4
|
-
// CMSes Stackbit Studio supports
|
|
5
|
-
export const CMS_NAMES = ['git', 'contentful', 'sanity', 'forestry', 'netlifycms'] as const;
|
|
6
|
-
|
|
7
|
-
export const FIELD_TYPES = [
|
|
8
|
-
'string',
|
|
9
|
-
'url',
|
|
10
|
-
'slug',
|
|
11
|
-
'text',
|
|
12
|
-
'markdown',
|
|
13
|
-
'html',
|
|
14
|
-
'number',
|
|
15
|
-
'boolean',
|
|
16
|
-
'enum',
|
|
17
|
-
'date',
|
|
18
|
-
'datetime',
|
|
19
|
-
'color',
|
|
20
|
-
'image',
|
|
21
|
-
'file',
|
|
22
|
-
'json',
|
|
23
|
-
'richText',
|
|
24
|
-
'object',
|
|
25
|
-
'model',
|
|
26
|
-
'reference',
|
|
27
|
-
'style',
|
|
28
|
-
'list'
|
|
29
|
-
] as const;
|
|
30
|
-
|
|
31
|
-
export const STYLE_PROPS = [
|
|
32
|
-
'objectFit',
|
|
33
|
-
'objectPosition',
|
|
34
|
-
'flexDirection',
|
|
35
|
-
'justifyContent',
|
|
36
|
-
'justifyItems',
|
|
37
|
-
'justifySelf',
|
|
38
|
-
'alignContent',
|
|
39
|
-
'alignItems',
|
|
40
|
-
'alignSelf',
|
|
41
|
-
'padding',
|
|
42
|
-
'margin',
|
|
43
|
-
'width',
|
|
44
|
-
'height',
|
|
45
|
-
'fontFamily',
|
|
46
|
-
'fontSize',
|
|
47
|
-
'fontStyle',
|
|
48
|
-
'fontWeight',
|
|
49
|
-
'textAlign',
|
|
50
|
-
'textColor',
|
|
51
|
-
'textDecoration',
|
|
52
|
-
'backgroundColor',
|
|
53
|
-
'backgroundPosition',
|
|
54
|
-
'backgroundSize',
|
|
55
|
-
'borderRadius',
|
|
56
|
-
'borderWidth',
|
|
57
|
-
'borderColor',
|
|
58
|
-
'borderStyle',
|
|
59
|
-
'boxShadow',
|
|
60
|
-
'opacity'
|
|
61
|
-
] as const;
|
|
62
|
-
|
|
63
|
-
export const STYLE_PROPS_VALUES = {
|
|
64
|
-
nineRegions: ['top', 'center', 'bottom', 'left', 'left-top', 'left-bottom', 'right', 'right-top', 'right-bottom'],
|
|
65
|
-
objectFit: ['none', 'contain', 'cover', 'fill', 'scale-down'],
|
|
66
|
-
flexDirection: ['row', 'row-reverse', 'col', 'col-reverse'],
|
|
67
|
-
justifyContent: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly'],
|
|
68
|
-
justifyItems: ['start', 'end', 'center', 'stretch'],
|
|
69
|
-
justifySelf: ['auto', 'start', 'end', 'center', 'stretch'],
|
|
70
|
-
alignContent: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch'],
|
|
71
|
-
alignItems: ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
|
|
72
|
-
alignSelf: ['auto', 'flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
|
|
73
|
-
width: ['auto', 'narrow', 'wide', 'full'],
|
|
74
|
-
height: ['auto', 'full', 'screen'],
|
|
75
|
-
fontStyle: ['normal', 'italic'],
|
|
76
|
-
fontWeight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
77
|
-
textAlign: ['left', 'center', 'right', 'justify'],
|
|
78
|
-
textDecoration: ['none', 'underline', 'line-through'],
|
|
79
|
-
backgroundSize: ['auto', 'cover', 'contain'],
|
|
80
|
-
borderRadius: ['none', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'full'],
|
|
81
|
-
borderStyle: ['solid', 'dashed', 'dotted', 'double', 'none'],
|
|
82
|
-
boxShadow: ['none', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'inner']
|
|
83
|
-
};
|
|
1
|
+
export { SSG_NAMES, CMS_NAMES, FIELD_TYPES, STYLE_PROPS, STYLE_PROPS_VALUES } from '@stackbit/types';
|
|
@@ -3,10 +3,11 @@ import fse from 'fs-extra';
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
|
|
5
5
|
import { omitByNil } from '@stackbit/utils';
|
|
6
|
+
import { Import } from '@stackbit/types';
|
|
6
7
|
|
|
7
8
|
import { ConfigLoadError, REFER_TO_STACKBIT_CONFIG_DOCS, STACKBIT_CONFIG_NOT_FOUND } from './config-errors';
|
|
8
9
|
import { findStackbitConfigFile, loadConfigFromStackbitYaml } from './config-loader-utils';
|
|
9
|
-
import { Config
|
|
10
|
+
import { Config } from './config-types';
|
|
10
11
|
|
|
11
12
|
const ROOT_PROPERTIES = [
|
|
12
13
|
'nodeVersion',
|
|
@@ -58,7 +59,9 @@ export type StaticConfig = Pick<
|
|
|
58
59
|
| 'publishDir'
|
|
59
60
|
| 'dirPath'
|
|
60
61
|
| 'filePath'
|
|
61
|
-
|
|
62
|
+
> & {
|
|
63
|
+
hasContentSources?: boolean;
|
|
64
|
+
};
|
|
62
65
|
|
|
63
66
|
export type LoadStaticConfigResult = {
|
|
64
67
|
config: StaticConfig | null;
|
|
@@ -153,7 +156,8 @@ async function loadStaticConfigFromStackbitJs(configFilePath: string): Promise<L
|
|
|
153
156
|
return accum;
|
|
154
157
|
},
|
|
155
158
|
{
|
|
156
|
-
import: parseImport(jsConfigString)
|
|
159
|
+
import: parseImport(jsConfigString),
|
|
160
|
+
hasContentSources: hasProperty(jsConfigString, 'contentSources') || null
|
|
157
161
|
}
|
|
158
162
|
)
|
|
159
163
|
),
|
|
@@ -208,3 +212,7 @@ function parseInlineProperty(jsConfigString: string, propertyName: string): any
|
|
|
208
212
|
}
|
|
209
213
|
return null;
|
|
210
214
|
}
|
|
215
|
+
|
|
216
|
+
function hasProperty(jsConfigString: string, propertyName: string): boolean {
|
|
217
|
+
return new RegExp(`\\b${propertyName}\\b`).test(jsConfigString);
|
|
218
|
+
}
|
|
@@ -4,9 +4,10 @@ import yaml from 'js-yaml';
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
6
6
|
import { parseFile, readDirRecursively, reducePromise, getFirstExistingFile } from '@stackbit/utils';
|
|
7
|
+
import { StackbitConfig as RawConfig, FieldEnum, FieldObjectProps } from '@stackbit/types';
|
|
7
8
|
|
|
8
9
|
import { ConfigLoadError, REFER_TO_STACKBIT_CONFIG_DOCS, STACKBIT_CONFIG_NOT_FOUND } from './config-errors';
|
|
9
|
-
import { Config,
|
|
10
|
+
import { Config, Model, YamlModelMap, YamlModel } from './config-types';
|
|
10
11
|
import { isEnumField, isListField, isObjectField, iterateModelFieldsRecursively, normalizeListFieldInPlace } from '../utils';
|
|
11
12
|
|
|
12
13
|
export const STACKBIT_CONFIG_YAML_FILES = ['stackbit.yaml', 'stackbit.yml'];
|
|
@@ -76,7 +77,7 @@ export async function loadConfigFromStackbitYaml(stackbitYamlPath: string): Prom
|
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
return {
|
|
79
|
-
config,
|
|
80
|
+
config: config as any,
|
|
80
81
|
error: null
|
|
81
82
|
};
|
|
82
83
|
}
|
|
@@ -103,7 +104,7 @@ export function convertToYamlConfig({ config }: { config: Config }): RawConfig {
|
|
|
103
104
|
if (!_.isEmpty(config.models)) {
|
|
104
105
|
yamlConfig.models = _.reduce(
|
|
105
106
|
config.models,
|
|
106
|
-
(yamlModels:
|
|
107
|
+
(yamlModels: YamlModelMap, model: Model) => {
|
|
107
108
|
if (model.type === 'image') {
|
|
108
109
|
return yamlModels;
|
|
109
110
|
}
|
|
@@ -220,6 +221,9 @@ function mergeConfigModelsWithModelsFromFiles(configModels: any, modelsFromFiles
|
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
function resolveThumbnailPathForModel(modelOrField: Model | FieldObjectProps, modelFilePath: string | undefined) {
|
|
224
|
+
if (modelOrField.type === 'image') {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
223
227
|
if (modelOrField.thumbnail && modelFilePath) {
|
|
224
228
|
const modelDirPath = path.dirname(modelFilePath);
|
|
225
229
|
modelOrField.thumbnail = resolveThumbnailPath(modelOrField.thumbnail, modelDirPath);
|
|
@@ -4,6 +4,7 @@ import chokidar from 'chokidar';
|
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
|
|
7
|
+
import { ModelsSource, FieldModel } from '@stackbit/types';
|
|
7
8
|
import { append, getFirstExistingFile, omitByNil, prepend, rename } from '@stackbit/utils';
|
|
8
9
|
|
|
9
10
|
import { ConfigValidationResult, validateConfig, validateContentModels } from './config-validator';
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
normalizeListFieldInPlace,
|
|
29
30
|
Logger
|
|
30
31
|
} from '../utils';
|
|
31
|
-
import { Config,
|
|
32
|
+
import type { Config, Model, SSGRunOptions, YamlModelMap, YamlModel, YamlDataModel, YamlPageModel } from './config-types';
|
|
32
33
|
import { loadPresets } from './presets-loader';
|
|
33
34
|
import {
|
|
34
35
|
LoadRawConfigResult,
|
|
@@ -189,7 +190,7 @@ export async function loadConfigFromDir({
|
|
|
189
190
|
dirPath: string;
|
|
190
191
|
stackbitConfigESBuildOutDir?: string;
|
|
191
192
|
watchCallback?: (rawConfigResult: RawConfigLoaderResult) => void;
|
|
192
|
-
logger?: Logger
|
|
193
|
+
logger?: Logger;
|
|
193
194
|
}): Promise<RawConfigLoaderResultWithStop> {
|
|
194
195
|
// try to load stackbit config from YAML files
|
|
195
196
|
try {
|
|
@@ -571,7 +572,7 @@ function normalizeConfig(config: any): any {
|
|
|
571
572
|
return config;
|
|
572
573
|
}
|
|
573
574
|
|
|
574
|
-
function updatePageUrlPath(model:
|
|
575
|
+
function updatePageUrlPath(model: YamlPageModel) {
|
|
575
576
|
// set default urlPath if not set
|
|
576
577
|
if (!model.urlPath) {
|
|
577
578
|
model.urlPath = '/{slug}';
|
|
@@ -584,7 +585,7 @@ function updatePageUrlPath(model: PageModel) {
|
|
|
584
585
|
* If the model has no `filePath` property, then `filePath` is naively inferred by
|
|
585
586
|
* prefixing `urlPath` with `pagesDir` and appending the `.md` extension.
|
|
586
587
|
*/
|
|
587
|
-
function updatePageFilePath(model:
|
|
588
|
+
function updatePageFilePath(model: YamlPageModel, config: Config) {
|
|
588
589
|
let filePath;
|
|
589
590
|
if (model.filePath) {
|
|
590
591
|
filePath = model.filePath;
|
|
@@ -604,7 +605,7 @@ function updatePageFilePath(model: PageModel, config: Config) {
|
|
|
604
605
|
model.filePath = path.join(parentDir, filePath);
|
|
605
606
|
}
|
|
606
607
|
|
|
607
|
-
function updateDataFilePath(model:
|
|
608
|
+
function updateDataFilePath(model: YamlDataModel, config: Config) {
|
|
608
609
|
let filePath;
|
|
609
610
|
if (model.filePath) {
|
|
610
611
|
filePath = model.filePath;
|
|
@@ -618,7 +619,7 @@ function updateDataFilePath(model: DataModel, config: Config) {
|
|
|
618
619
|
model.filePath = path.join(parentDir, filePath);
|
|
619
620
|
}
|
|
620
621
|
|
|
621
|
-
function addMarkdownContentField(model:
|
|
622
|
+
function addMarkdownContentField(model: YamlPageModel) {
|
|
622
623
|
if (model.hideContent) {
|
|
623
624
|
return;
|
|
624
625
|
}
|
|
@@ -720,7 +721,7 @@ function validateAndExtendContentModels(config: RawConfigWithPaths): ConfigValid
|
|
|
720
721
|
};
|
|
721
722
|
}
|
|
722
723
|
|
|
723
|
-
const extendedModels:
|
|
724
|
+
const extendedModels: YamlModelMap = _.mapValues(
|
|
724
725
|
models,
|
|
725
726
|
(model, modelName): YamlModel => {
|
|
726
727
|
const contentModel = validationResult.value.contentModels![modelName];
|
|
@@ -847,7 +848,7 @@ function convertModelGroupsToModelList(validationResult: ConfigValidationResult)
|
|
|
847
848
|
});
|
|
848
849
|
|
|
849
850
|
_.forEach(models, (model) => {
|
|
850
|
-
iterateModelFieldsRecursively(model
|
|
851
|
+
iterateModelFieldsRecursively(model, (field: any) => {
|
|
851
852
|
if (isListField(field)) {
|
|
852
853
|
field = field.items;
|
|
853
854
|
}
|
|
@@ -882,7 +883,7 @@ function convertModelsToArray(validationResult: ConfigValidationResult): Normali
|
|
|
882
883
|
// convert 'models' to array of objects and set their 'name' property to the
|
|
883
884
|
// model name
|
|
884
885
|
const modelMap = models ?? {};
|
|
885
|
-
const modelArray: Model[] = _.map(
|
|
886
|
+
const modelArray: Model[] = (_.map(
|
|
886
887
|
modelMap,
|
|
887
888
|
(yamlModel: YamlModel, modelName: string): Model => {
|
|
888
889
|
return {
|
|
@@ -890,7 +891,7 @@ function convertModelsToArray(validationResult: ConfigValidationResult): Normali
|
|
|
890
891
|
...yamlModel
|
|
891
892
|
};
|
|
892
893
|
}
|
|
893
|
-
);
|
|
894
|
+
) as unknown) as Model[];
|
|
894
895
|
|
|
895
896
|
if (!isGitCMS(config)) {
|
|
896
897
|
addImageModel(modelArray);
|
|
@@ -935,7 +936,7 @@ function isGitCMS(config: RawConfigWithPaths) {
|
|
|
935
936
|
return !config.contentSources && (!config.cmsName || config.cmsName === 'git');
|
|
936
937
|
}
|
|
937
938
|
|
|
938
|
-
function getInternalStackbitRunnerOptions(config: any) {
|
|
939
|
+
function getInternalStackbitRunnerOptions(config: any): SSGRunOptions {
|
|
939
940
|
const experimentalSsgData = _.get(config, 'experimental.ssg');
|
|
940
941
|
if (!experimentalSsgData) {
|
|
941
942
|
return _.get(config, '__unsafe_internal_stackbitRunnerOptions');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Joi, { CustomHelpers, ErrorReport } from 'joi';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import { Field } from '
|
|
3
|
+
import { Field } from '@stackbit/types';
|
|
4
4
|
import { STYLE_PROPS_VALUES } from '../config-consts';
|
|
5
5
|
|
|
6
6
|
const sizePattern = /^[xylrtb](?:\d+(?::\d+(?::\d+)?)?)?|\d+(?::\d+(?::\d+)?)?$/;
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { append } from '@stackbit/utils';
|
|
4
|
-
import { CMS_NAMES, FIELD_TYPES, SSG_NAMES } from './config-consts';
|
|
5
|
-
import { styleFieldPartialSchema } from './config-schema/style-field-schema';
|
|
6
4
|
import {
|
|
7
|
-
|
|
5
|
+
StackbitConfig,
|
|
8
6
|
ContentfulImport,
|
|
9
|
-
Field,
|
|
10
|
-
FieldObjectProps,
|
|
11
|
-
ModelsSource,
|
|
12
|
-
PresetSource,
|
|
13
|
-
PresetSourceFiles,
|
|
14
7
|
SanityImport,
|
|
15
|
-
|
|
16
|
-
RawConfig,
|
|
17
|
-
YamlConfigModel,
|
|
18
|
-
YamlDataModel,
|
|
19
|
-
YamlModel,
|
|
20
|
-
ModelMap,
|
|
21
|
-
YamlPageModel,
|
|
22
|
-
FieldGroupItem,
|
|
23
|
-
YamlObjectModel,
|
|
8
|
+
Assets,
|
|
24
9
|
ContentModelMap,
|
|
25
10
|
ContentModel,
|
|
11
|
+
PresetSourceFiles,
|
|
12
|
+
PresetSource,
|
|
13
|
+
ModelsSource,
|
|
26
14
|
ModelsSourceFiles,
|
|
27
15
|
ModelsSourceContentful,
|
|
28
|
-
ModelsSourceSanity
|
|
29
|
-
|
|
16
|
+
ModelsSourceSanity,
|
|
17
|
+
Field,
|
|
18
|
+
FieldObjectProps,
|
|
19
|
+
FieldGroupItem
|
|
20
|
+
} from '@stackbit/types';
|
|
21
|
+
|
|
22
|
+
import { CMS_NAMES, FIELD_TYPES, SSG_NAMES } from './config-consts';
|
|
23
|
+
import { styleFieldPartialSchema } from './config-schema/style-field-schema';
|
|
24
|
+
import { YamlBaseModel, YamlConfigModel, YamlDataModel, YamlModel, YamlModelMap, YamlPageModel, YamlObjectModel } from './config-types';
|
|
30
25
|
|
|
31
|
-
function getConfigFromValidationState(state: Joi.State):
|
|
26
|
+
function getConfigFromValidationState(state: Joi.State): StackbitConfig {
|
|
32
27
|
return _.last(state.ancestors)!;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
function getModelsFromValidationState(state: Joi.State):
|
|
30
|
+
function getModelsFromValidationState(state: Joi.State): YamlModelMap {
|
|
36
31
|
const config = getConfigFromValidationState(state);
|
|
37
32
|
return config.models ?? {};
|
|
38
33
|
}
|
|
@@ -128,7 +123,7 @@ const validReferenceFieldGroups = Joi.string()
|
|
|
128
123
|
errors: { wrap: { label: false } }
|
|
129
124
|
});
|
|
130
125
|
|
|
131
|
-
function getModelNamesForGroup(group: string, config:
|
|
126
|
+
function getModelNamesForGroup(group: string, config: StackbitConfig) {
|
|
132
127
|
const models = config.models ?? {};
|
|
133
128
|
return _.reduce(
|
|
134
129
|
models,
|
|
@@ -646,9 +641,9 @@ const modelListForbiddenErrorCode = 'model.items.forbidden';
|
|
|
646
641
|
const fieldNameUnique = 'field.name.unique';
|
|
647
642
|
const groupModelsIncompatibleError = 'group.models.incompatible';
|
|
648
643
|
|
|
649
|
-
const modelsSchema = Joi.object<
|
|
644
|
+
const modelsSchema = Joi.object<YamlModelMap>()
|
|
650
645
|
.pattern(modelNamePattern, modelSchema)
|
|
651
|
-
.custom((models:
|
|
646
|
+
.custom((models: YamlModelMap, { error }) => {
|
|
652
647
|
const groupMap: Record<string, Record<'objectModels' | 'documentModels', string[]>> = {};
|
|
653
648
|
|
|
654
649
|
_.forEach(models, (model, modelName) => {
|
|
@@ -719,7 +714,7 @@ const modelsSchema = Joi.object<ModelMap>()
|
|
|
719
714
|
errors: { wrap: { label: false } }
|
|
720
715
|
});
|
|
721
716
|
|
|
722
|
-
export const stackbitConfigSchema = Joi.object<
|
|
717
|
+
export const stackbitConfigSchema = Joi.object<StackbitConfig>({
|
|
723
718
|
stackbitVersion: Joi.string().required(),
|
|
724
719
|
ssgName: Joi.string().valid(...SSG_NAMES),
|
|
725
720
|
ssgVersion: Joi.string(),
|