@teleporthq/teleport-project-generator-next 0.44.13 → 0.44.15
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/__tests__/content-category-pages.test.ts +16 -1
- package/__tests__/end2end/component-variants.ts +192 -0
- package/dist/cjs/blog/content-category-pages.d.ts.map +1 -1
- package/dist/cjs/blog/content-category-pages.js +1 -1
- package/dist/cjs/blog/content-category-pages.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/blog/content-category-pages.d.ts.map +1 -1
- package/dist/esm/blog/content-category-pages.js +1 -1
- package/dist/esm/blog/content-category-pages.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/src/blog/content-category-pages.ts +16 -1
|
@@ -220,7 +220,11 @@ describe('the content-category-pages module', () => {
|
|
|
220
220
|
helpPosts: async (params) => {
|
|
221
221
|
calls.push(params)
|
|
222
222
|
return [
|
|
223
|
-
post({
|
|
223
|
+
post({
|
|
224
|
+
excerpt: 'Point your domain at the site',
|
|
225
|
+
content: '<p>Every step of connecting a domain</p>',
|
|
226
|
+
relatedPosts: [post({ id: 'p9' })],
|
|
227
|
+
}),
|
|
224
228
|
post({ id: 'p2', slug: 'old', redirectUrl: '/help/connect-a-domain' }),
|
|
225
229
|
post({ id: 'p3', slug: '' }),
|
|
226
230
|
]
|
|
@@ -243,6 +247,17 @@ describe('the content-category-pages module', () => {
|
|
|
243
247
|
expect(page.posts.map((entry) => [entry.id, entry.href])).toEqual([
|
|
244
248
|
['p1', '/help/connect-a-domain'],
|
|
245
249
|
])
|
|
250
|
+
// A card, not a page: no body and none of the post's own lists.
|
|
251
|
+
expect(page.posts[0]).toMatchObject({
|
|
252
|
+
title: 'Connect a domain',
|
|
253
|
+
excerpt: 'Point your domain at the site',
|
|
254
|
+
content: '',
|
|
255
|
+
relatedPosts: [],
|
|
256
|
+
previousPosts: [],
|
|
257
|
+
nextPosts: [],
|
|
258
|
+
comments: [],
|
|
259
|
+
sections: [],
|
|
260
|
+
})
|
|
246
261
|
|
|
247
262
|
// One read: the category's published posts, newest first, in the locale.
|
|
248
263
|
expect(calls).toHaveLength(1)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import generate from '@babel/generator'
|
|
2
|
+
import { parse } from '@babel/parser'
|
|
3
|
+
import * as types from '@babel/types'
|
|
4
|
+
import {
|
|
5
|
+
GeneratedFolder,
|
|
6
|
+
ProjectUIDL,
|
|
7
|
+
UIDLConditionalNode,
|
|
8
|
+
UIDLElementNode,
|
|
9
|
+
} from '@teleporthq/teleport-types'
|
|
10
|
+
import uidlSample from '../../../../examples/uidl-samples/component-variants.json'
|
|
11
|
+
import template from './template-definition.json'
|
|
12
|
+
import { createNextProjectGenerator } from '../../src'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A button component with four looks: `btn` always, plus `btn-<look>` while
|
|
16
|
+
* the `buttonType` prop (default "primary") names it, and `btn-full` while the
|
|
17
|
+
* boolean `fullWidth` prop is true. The Next.js export decides at runtime, so
|
|
18
|
+
* the test reads the generated component's `className` and `defaultProps`,
|
|
19
|
+
* then evaluates the class list each placed instance renders with.
|
|
20
|
+
*/
|
|
21
|
+
const nodesOfType = <T extends types.Node>(root: types.Node, type: T['type']): T[] => {
|
|
22
|
+
const found: T[] = []
|
|
23
|
+
const visit = (value: unknown) => {
|
|
24
|
+
if (Array.isArray(value)) {
|
|
25
|
+
value.forEach(visit)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
if (!value || typeof value !== 'object' || typeof (value as types.Node).type !== 'string') {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
if ((value as types.Node).type === type) {
|
|
32
|
+
found.push(value as T)
|
|
33
|
+
}
|
|
34
|
+
Object.entries(value).forEach(([key, child]) => {
|
|
35
|
+
if (key !== 'loc' && !key.endsWith('Comments')) {
|
|
36
|
+
visit(child)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
visit(root)
|
|
41
|
+
return found
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// tslint:disable-next-line function-constructor
|
|
45
|
+
const evaluate = (code: string, props: Record<string, unknown> = {}) =>
|
|
46
|
+
new Function('props', `return (${code})`)(props)
|
|
47
|
+
|
|
48
|
+
const sourceOf = (folder: GeneratedFolder, folderName: string, fileName: string) => {
|
|
49
|
+
const file = folder.subFolders
|
|
50
|
+
.find((subFolder) => subFolder.name === folderName)
|
|
51
|
+
?.files.find((candidate) => candidate.name === fileName && candidate.fileType === 'js')
|
|
52
|
+
if (!file) {
|
|
53
|
+
throw new Error(`${folderName}/${fileName}.js was not generated`)
|
|
54
|
+
}
|
|
55
|
+
return parse(file.content, { sourceType: 'module', plugins: ['jsx'] })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const classesByLabel = async (uidl: ProjectUIDL): Promise<Record<string, string>> => {
|
|
59
|
+
const output = await createNextProjectGenerator().generateProject(uidl, template)
|
|
60
|
+
const component = sourceOf(output, 'components', 'action-button')
|
|
61
|
+
const page = sourceOf(output, 'pages', 'index')
|
|
62
|
+
|
|
63
|
+
const className = nodesOfType<types.JSXAttribute>(component, 'JSXAttribute').find(
|
|
64
|
+
(attribute) => attribute.name.name === 'className'
|
|
65
|
+
)
|
|
66
|
+
const classExpression = generate(
|
|
67
|
+
(className.value as types.JSXExpressionContainer).expression as types.Expression
|
|
68
|
+
).code
|
|
69
|
+
const defaultProps = nodesOfType<types.AssignmentExpression>(
|
|
70
|
+
component,
|
|
71
|
+
'AssignmentExpression'
|
|
72
|
+
).find((assignment) => generate(assignment.left).code === 'ActionButton.defaultProps')
|
|
73
|
+
const defaults = evaluate(generate(defaultProps.right).code)
|
|
74
|
+
|
|
75
|
+
const instances = nodesOfType<types.JSXOpeningElement>(page, 'JSXOpeningElement').filter(
|
|
76
|
+
(element) => generate(element.name).code === 'ActionButton'
|
|
77
|
+
)
|
|
78
|
+
return Object.fromEntries(
|
|
79
|
+
instances.map((instance) => {
|
|
80
|
+
const props: Record<string, unknown> = { ...defaults }
|
|
81
|
+
instance.attributes.forEach((attribute) => {
|
|
82
|
+
if (attribute.type !== 'JSXAttribute') {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
const { value } = attribute
|
|
86
|
+
props[String(attribute.name.name)] =
|
|
87
|
+
value === null
|
|
88
|
+
? true
|
|
89
|
+
: value.type === 'StringLiteral'
|
|
90
|
+
? value.value
|
|
91
|
+
: evaluate(generate((value as types.JSXExpressionContainer).expression).code)
|
|
92
|
+
})
|
|
93
|
+
const classes = String(evaluate(classExpression, props)).split(/\s+/).filter(Boolean)
|
|
94
|
+
return [String(props.label), classes.join(' ')]
|
|
95
|
+
})
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const fixture = () => JSON.parse(JSON.stringify(uidlSample)) as ProjectUIDL
|
|
100
|
+
|
|
101
|
+
const homeOf = (uidl: ProjectUIDL) => {
|
|
102
|
+
const home = (uidl.root.node.content.children[0] as UIDLConditionalNode).content.node
|
|
103
|
+
if (home.type !== 'element') {
|
|
104
|
+
throw new Error('fixture drifted: Home is not an element')
|
|
105
|
+
}
|
|
106
|
+
return home
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const placeButton = (uidl: ProjectUIDL, key: string, attrs: Record<string, unknown>) =>
|
|
110
|
+
homeOf(uidl).content.children.push({
|
|
111
|
+
type: 'element',
|
|
112
|
+
content: {
|
|
113
|
+
elementType: 'ActionButton',
|
|
114
|
+
semanticType: 'ActionButton',
|
|
115
|
+
key,
|
|
116
|
+
name: key,
|
|
117
|
+
dependency: { type: 'local' },
|
|
118
|
+
attrs: Object.fromEntries(
|
|
119
|
+
Object.entries(attrs).map(([name, content]) => [name, { type: 'static', content }])
|
|
120
|
+
),
|
|
121
|
+
children: [],
|
|
122
|
+
},
|
|
123
|
+
} as UIDLElementNode)
|
|
124
|
+
|
|
125
|
+
const classWhen = (referenceId: string, propId: string, operands: string[]) => ({
|
|
126
|
+
type: 'style-map' as const,
|
|
127
|
+
content: {
|
|
128
|
+
mapType: 'project-referenced' as const,
|
|
129
|
+
referenceId,
|
|
130
|
+
condition: {
|
|
131
|
+
reference: {
|
|
132
|
+
type: 'dynamic' as const,
|
|
133
|
+
content: { referenceType: 'prop' as const, id: propId },
|
|
134
|
+
},
|
|
135
|
+
expression: { conditions: operands.map((operand) => ({ operation: '===', operand })) },
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
describe('Component variants in the Next.js export', () => {
|
|
141
|
+
it('renders every instance with the base class and exactly its own look', async () => {
|
|
142
|
+
expect(await classesByLabel(fixture())).toEqual({
|
|
143
|
+
Primary: 'btn btn-primary',
|
|
144
|
+
Secondary: 'btn btn-secondary',
|
|
145
|
+
Outline: 'btn btn-outline',
|
|
146
|
+
Link: 'btn btn-link',
|
|
147
|
+
Unset: 'btn btn-primary',
|
|
148
|
+
'Full width': 'btn btn-outline btn-full',
|
|
149
|
+
'Not full width': 'btn btn-primary',
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('still generates, with the class left off, when a class condition is dangling', async () => {
|
|
154
|
+
const uidl = fixture()
|
|
155
|
+
const button = uidl.components.ActionButton.node.content
|
|
156
|
+
const dangling = (referenceId: string, propId: string, operands: string[]) => ({
|
|
157
|
+
type: 'style-map' as const,
|
|
158
|
+
content: {
|
|
159
|
+
mapType: 'project-referenced' as const,
|
|
160
|
+
referenceId,
|
|
161
|
+
condition: {
|
|
162
|
+
reference: {
|
|
163
|
+
type: 'dynamic' as const,
|
|
164
|
+
content: { referenceType: 'prop' as const, id: propId },
|
|
165
|
+
},
|
|
166
|
+
expression: { conditions: operands.map((operand) => ({ operation: '===', operand })) },
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
button.referencedStyles.deletedProp = dangling('btn-link', 'removedProp', ['x'])
|
|
171
|
+
button.referencedStyles.noRule = dangling('btn-full', 'buttonType', [])
|
|
172
|
+
|
|
173
|
+
const classes = await classesByLabel(uidl)
|
|
174
|
+
|
|
175
|
+
expect(classes.Outline).toBe('btn btn-outline')
|
|
176
|
+
expect(classes['Full width']).toBe('btn btn-outline btn-full')
|
|
177
|
+
expect(classes.Unset).toBe('btn btn-primary')
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
it('applies a class on a number prop whose default and rule both store the number as text', async () => {
|
|
181
|
+
const uidl = fixture()
|
|
182
|
+
uidl.root.styleSetDefinitions['btn-size-two'] = uidl.root.styleSetDefinitions['btn-full']
|
|
183
|
+
const actionButton = uidl.components.ActionButton
|
|
184
|
+
actionButton.propDefinitions.size = { type: 'number', defaultValue: '2' }
|
|
185
|
+
actionButton.node.content.referencedStyles.sizeTwo = classWhen('btn-size-two', 'size', ['2'])
|
|
186
|
+
placeButton(uidl, 'sizeThreeButton', { size: 3, label: 'Size three' })
|
|
187
|
+
|
|
188
|
+
const classes = await classesByLabel(uidl)
|
|
189
|
+
expect(classes.Primary).toBe('btn btn-primary btn-size-two')
|
|
190
|
+
expect(classes['Size three']).toBe('btn btn-primary')
|
|
191
|
+
})
|
|
192
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-category-pages.d.ts","sourceRoot":"","sources":["../../../src/blog/content-category-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAG1E,qHAAqH;AACrH,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,aAAa,CAAC,gBAAgB,CAAA;IACnC,QAAQ,EAAE,wBAAwB,CAAA;IAClC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAA;IACrB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,qGAAqG;AACrG,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,gBAAgB,EAAE,MAAM,CAGvE,CAAA;AAED,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,QAAS,cAAc,gBAAgB,KAAG,MACtE,CAAA;AAUf;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kCAAkC,YACpC,0BAA0B,EAAE,KACpC,
|
|
1
|
+
{"version":3,"file":"content-category-pages.d.ts","sourceRoot":"","sources":["../../../src/blog/content-category-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAG1E,qHAAqH;AACrH,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,aAAa,CAAC,gBAAgB,CAAA;IACnC,QAAQ,EAAE,wBAAwB,CAAA;IAClC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAA;IACrB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,qGAAqG;AACrG,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,gBAAgB,EAAE,MAAM,CAGvE,CAAA;AAED,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,QAAS,cAAc,gBAAgB,KAAG,MACtE,CAAA;AAUf;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kCAAkC,YACpC,0BAA0B,EAAE,KACpC,MAuKF,CAAA"}
|
|
@@ -70,7 +70,7 @@ var generateContentCategoryPagesSource = function (presets) {
|
|
|
70
70
|
"}",
|
|
71
71
|
].join('\n');
|
|
72
72
|
});
|
|
73
|
-
return "import { ".concat(treeImports.join(', '), ", localizeCategoryTree } from '@/blog-context'\n").concat(fetcherImports.join('\n'), "\n\n// The category pages' server-side reads. Generated from the content settings in the editor.\nvar PRESETS = {\n").concat(presetEntries.join('\n'), "\n}\nvar POST_LIMIT = ").concat(exports.CATEGORY_PAGE_POST_LIMIT, "\nvar CATEGORY_COLUMN = 'category_filter_ids'\nvar PUBLISHED_ONLY = { type: 'condition', source: 'status', destination: 'published', operand: '=' }\n// Public pages: the posts as a visitor is served them (published, no author\n// email), never as the store reads its own table.\nvar PAGE_READ = { as: 'visitor' }\n\n// A post field under its transformed name, else its column name.\nfunction field(post, key, column) {\n var value = post[key]\n return value === undefined || value === null || value === '' ? post[column] : value\n}\n\nfunction redirectsElsewhere(post) {\n var target = field(post, 'redirectUrl', 'redirect_url')\n return typeof target === 'string' && target.trim() !== ''\n}\n\n// Every category of the tree with the path of ancestors above it, top to bottom.\nfunction flattenTree(nodes, trail, out) {\n ;(nodes || []).forEach(function (node) {\n var path = trail.concat([node])\n out.push({ node: node, path: path })\n flattenTree(node.children, path, out)\n })\n return out\n}\n\nfunction categoryHref(config, category) {\n return config.categoryPath + '/' + encodeURIComponent(category.slug)\n}\n\nfunction postHref(config, post) {\n var key = field(post, config.postUrlKey, config.postUrlField)\n key = key === undefined || key === null ? '' : String(key).trim()\n return key ? config.postPath + '/' + encodeURIComponent(key) : null\n}\n\n// A category as a link: what the breadcrumbs and the subcategory cards show.\nfunction categorySummary(config, category) {\n return {\n id: category.id,\n name: category.name,\n slug: category.slug,\n description: category.description || '',\n icon: category.icon || null,\n imageUrl: category.imageUrl || null,\n href: categoryHref(config, category),\n childCount: (category.children || []).length,\n }\n}\n\n").concat(arranged_order_runtime_1.ARRANGED_ORDER_RUNTIME, "\n\nasync function resolveCategoryPage(preset, params) {\n var slug = params && params.slug !== undefined && params.slug !== null ? String(params.slug) : ''\n var locale = params && params.locale ? params.locale : null\n var tree = localizeCategoryTree(preset.tree, locale)\n var found = flattenTree(tree, [], []).filter(function (entry) {\n return entry.node.slug === slug\n })[0]\n if (!slug || !found) {\n return { data: null }\n }\n var category = found.node\n var rows = await preset.posts.fetchData({\n limit: POST_LIMIT,\n sortBy: 'created_at',\n sortOrder: 'desc',\n filters: JSON.stringify([\n PUBLISHED_ONLY,\n { type: 'condition', source: CATEGORY_COLUMN, destination: category.id, operand: 'array_overlap' },\n ]),\n locale: locale || undefined,\n }, PAGE_READ)\n var posts = []\n ;(Array.isArray(rows) ? rows : []).forEach(function (post) {\n if (!post || typeof post !== 'object' || redirectsElsewhere(post)) return\n var href = postHref(preset.config, post)\n if (href) posts.push(
|
|
73
|
+
return "import { ".concat(treeImports.join(', '), ", localizeCategoryTree } from '@/blog-context'\n").concat(fetcherImports.join('\n'), "\n\n// The category pages' server-side reads. Generated from the content settings in the editor.\nvar PRESETS = {\n").concat(presetEntries.join('\n'), "\n}\nvar POST_LIMIT = ").concat(exports.CATEGORY_PAGE_POST_LIMIT, "\nvar CATEGORY_COLUMN = 'category_filter_ids'\nvar PUBLISHED_ONLY = { type: 'condition', source: 'status', destination: 'published', operand: '=' }\n// Public pages: the posts as a visitor is served them (published, no author\n// email), never as the store reads its own table.\nvar PAGE_READ = { as: 'visitor' }\n\n// A post field under its transformed name, else its column name.\nfunction field(post, key, column) {\n var value = post[key]\n return value === undefined || value === null || value === '' ? post[column] : value\n}\n\nfunction redirectsElsewhere(post) {\n var target = field(post, 'redirectUrl', 'redirect_url')\n return typeof target === 'string' && target.trim() !== ''\n}\n\n// Every category of the tree with the path of ancestors above it, top to bottom.\nfunction flattenTree(nodes, trail, out) {\n ;(nodes || []).forEach(function (node) {\n var path = trail.concat([node])\n out.push({ node: node, path: path })\n flattenTree(node.children, path, out)\n })\n return out\n}\n\nfunction categoryHref(config, category) {\n return config.categoryPath + '/' + encodeURIComponent(category.slug)\n}\n\nfunction postHref(config, post) {\n var key = field(post, config.postUrlKey, config.postUrlField)\n key = key === undefined || key === null ? '' : String(key).trim()\n return key ? config.postPath + '/' + encodeURIComponent(key) : null\n}\n\n// A category as a link: what the breadcrumbs and the subcategory cards show.\nfunction categorySummary(config, category) {\n return {\n id: category.id,\n name: category.name,\n slug: category.slug,\n description: category.description || '',\n icon: category.icon || null,\n imageUrl: category.imageUrl || null,\n href: categoryHref(config, category),\n childCount: (category.children || []).length,\n }\n}\n\n").concat(arranged_order_runtime_1.ARRANGED_ORDER_RUNTIME, "\n\n// A category page lists cards: each post without its body or its own lists,\n// which no card shows (a 44-post category page carried 621 kB of data).\n// MUST mirror `card` in packages/renderer/src/utils/blog-posts.ts (teleport-gui).\nfunction postCard(post, href) {\n return Object.assign({}, post, {\n href: href,\n content: '',\n relatedPosts: [],\n previousPosts: [],\n nextPosts: [],\n comments: [],\n sections: [],\n })\n}\n\nasync function resolveCategoryPage(preset, params) {\n var slug = params && params.slug !== undefined && params.slug !== null ? String(params.slug) : ''\n var locale = params && params.locale ? params.locale : null\n var tree = localizeCategoryTree(preset.tree, locale)\n var found = flattenTree(tree, [], []).filter(function (entry) {\n return entry.node.slug === slug\n })[0]\n if (!slug || !found) {\n return { data: null }\n }\n var category = found.node\n var rows = await preset.posts.fetchData({\n limit: POST_LIMIT,\n sortBy: 'created_at',\n sortOrder: 'desc',\n filters: JSON.stringify([\n PUBLISHED_ONLY,\n { type: 'condition', source: CATEGORY_COLUMN, destination: category.id, operand: 'array_overlap' },\n ]),\n locale: locale || undefined,\n }, PAGE_READ)\n var posts = []\n ;(Array.isArray(rows) ? rows : []).forEach(function (post) {\n if (!post || typeof post !== 'object' || redirectsElsewhere(post)) return\n var href = postHref(preset.config, post)\n if (href) posts.push(postCard(post, href))\n })\n if (preset.config.arranged) posts = arrangeCategoryPosts(posts, category)\n var summary = categorySummary(preset.config, category)\n return {\n data: Object.assign(summary, {\n breadcrumbs: found.path.slice(0, -1).map(function (ancestor) {\n return categorySummary(preset.config, ancestor)\n }),\n // Top category down to this one: what the sidebar layout highlights and opens.\n pathIds: found.path.map(function (node) {\n return node.id\n }),\n children: (category.children || []).map(function (child) {\n return categorySummary(preset.config, child)\n }),\n posts: posts,\n postCount: posts.length,\n }),\n }\n}\n\nasync function listCategoryPaths(preset) {\n return {\n data: flattenTree(preset.tree, [], []).map(function (entry) {\n return { slug: entry.node.slug }\n }),\n }\n}\n\n").concat(exportedFunctions.join('\n\n'), "\n");
|
|
74
74
|
};
|
|
75
75
|
exports.generateContentCategoryPagesSource = generateContentCategoryPagesSource;
|
|
76
76
|
/** `author_name` → `authorName`: the key the post transform exposes a column under. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-category-pages.js","sourceRoot":"","sources":["../../../src/blog/content-category-pages.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAE3D,mEAAiE;AAEjE,qHAAqH;AACxG,QAAA,wBAAwB,GAAG,GAAG,CAAA;AAW3C,qGAAqG;AACxF,QAAA,YAAY,GAAmD;IAC1E,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;CAC3B,CAAA;AAED,uFAAuF;AAChF,IAAM,8BAA8B,GAAG,UAAC,GAAmC;IAChF,OAAA,UAAG,GAAG,UAAO;AAAb,CAAa,CAAA;AADF,QAAA,8BAA8B,kCAC5B;AAEf,IAAM,UAAU,GAAG,UAAC,IAAY;IAC9B,IAAM,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACvD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,EAAE,CAAA;KACV;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAI,OAAO,CAAE,CAAA;AAC1D,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,IAAM,kCAAkC,GAAG,UAChD,OAAqC;IAErC,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,oBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAxB,CAAwB,CAAC,CAAA;IACrE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