@nakedcreativity/cee-ms-node 2.0.0-beta.10 → 2.0.0-beta.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/README.md +1 -174
- package/lib/draft.js +3 -8
- package/lib/draft.js.map +1 -1
- package/lib/index.d.ts +4 -31
- package/lib/index.js +18 -123
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +2 -276
- package/lib/interfaces.js +0 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/links.d.ts +2 -67
- package/lib/links.js +7 -201
- package/lib/links.js.map +1 -1
- package/lib/storage.d.ts +0 -1
- package/lib/storage.js +1 -3
- package/lib/storage.js.map +1 -1
- package/lib/tags/blog.d.ts +2 -3
- package/lib/tags/blog.js +5 -14
- package/lib/tags/blog.js.map +1 -1
- package/lib/tags/index.d.ts +0 -2
- package/lib/tags/index.js +0 -2
- package/lib/tags/index.js.map +1 -1
- package/package.json +1 -8
- package/lib/social-meta.d.ts +0 -15
- package/lib/social-meta.js +0 -74
- package/lib/social-meta.js.map +0 -1
- package/lib/structured-data.d.ts +0 -35
- package/lib/structured-data.js +0 -591
- package/lib/structured-data.js.map +0 -1
- package/lib/tags/social-meta.d.ts +0 -6
- package/lib/tags/social-meta.js +0 -19
- package/lib/tags/social-meta.js.map +0 -1
- package/lib/tags/structured-data.d.ts +0 -8
- package/lib/tags/structured-data.js +0 -36
- package/lib/tags/structured-data.js.map +0 -1
- package/lib/views.d.ts +0 -76
- package/lib/views.js +0 -426
- package/lib/views.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Liquid } from 'liquidjs';
|
|
2
|
-
/**
|
|
3
|
-
* `{% structureddata ['article' 'faq' 'entity' …] %}` outputs the page's schema.org JSON-LD: the types the page
|
|
4
|
-
* has switched on (or the site's defaults) and its entity (product, event…), built from the page, its modules
|
|
5
|
-
* and the site's organisation. Naming parts limits it to those, for templates that place them separately.
|
|
6
|
-
* Outputs nothing when there is nothing.
|
|
7
|
-
*/
|
|
8
|
-
export declare function registerStructuredDataTag(engine: Liquid): void;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerStructuredDataTag = registerStructuredDataTag;
|
|
4
|
-
const state_1 = require("../state");
|
|
5
|
-
const structured_data_1 = require("../structured-data");
|
|
6
|
-
/**
|
|
7
|
-
* `{% structureddata ['article' 'faq' 'entity' …] %}` outputs the page's schema.org JSON-LD: the types the page
|
|
8
|
-
* has switched on (or the site's defaults) and its entity (product, event…), built from the page, its modules
|
|
9
|
-
* and the site's organisation. Naming parts limits it to those, for templates that place them separately.
|
|
10
|
-
* Outputs nothing when there is nothing.
|
|
11
|
-
*/
|
|
12
|
-
function registerStructuredDataTag(engine) {
|
|
13
|
-
engine.registerTag('structureddata', {
|
|
14
|
-
parse: function (tagToken) {
|
|
15
|
-
const names = tagToken.args
|
|
16
|
-
.split(/[\s,]+/)
|
|
17
|
-
.map((arg) => arg.replace(/^['"]|['"]$/g, '').toUpperCase())
|
|
18
|
-
.filter(Boolean);
|
|
19
|
-
for (const name of names) {
|
|
20
|
-
if (!structured_data_1.STRUCTURED_DATA_PARTS.includes(name)) {
|
|
21
|
-
throw new Error(`structureddata: unknown part "${name}"`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
this.only = names.length ? names : undefined;
|
|
25
|
-
},
|
|
26
|
-
render: function (context) {
|
|
27
|
-
const { site, page } = (0, state_1.renderState)(context);
|
|
28
|
-
const graph = (0, structured_data_1.structuredDataGraph)(site, page, this.only);
|
|
29
|
-
if (!graph['@graph'].length) {
|
|
30
|
-
return '';
|
|
31
|
-
}
|
|
32
|
-
return '<script type="application/ld+json">' + (0, structured_data_1.serialiseJsonLd)(graph) + '</script>';
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=structured-data.js.map
|
|
@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;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/lib/views.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type express from 'express';
|
|
2
|
-
/**
|
|
3
|
-
* What a site's views need from the editor, read from their source: which are layouts (templates, with the
|
|
4
|
-
* regions they place) and which are modules (module types, with the values they read). Served to the Cee.ms
|
|
5
|
-
* editor at `GET /ceems/views`, which suggests templates and module types from it.
|
|
6
|
-
*
|
|
7
|
-
* Views can be grouped in folders, `layouts/`, `modules/` and `partials/`, which then decide what each one
|
|
8
|
-
* is. A site with none of them keeps every view at the top: a view with a `{% region %}` is a layout, and the
|
|
9
|
-
* rest are modules. Either way a view is named by its file name alone, as templates and modules refer to it.
|
|
10
|
-
*/
|
|
11
|
-
/** The folders views can be grouped in, in the order a name is looked up. */
|
|
12
|
-
export declare const VIEW_FOLDERS: readonly ["layouts", "modules", "partials"];
|
|
13
|
-
/** The page id the Cee.ms API signs a preview token with to read the views. */
|
|
14
|
-
export declare const VIEWS_TOKEN_SUBJECT = "ceems:views";
|
|
15
|
-
export interface ViewManifest {
|
|
16
|
-
version: 1;
|
|
17
|
-
views: ViewInfo[];
|
|
18
|
-
warnings: string[];
|
|
19
|
-
}
|
|
20
|
-
export interface ViewInfo {
|
|
21
|
-
/** The file name without `.liquid`: what a module's `type` and a template's `layout` name. */
|
|
22
|
-
name: string;
|
|
23
|
-
/** Relative to the views folder, e.g. `modules/text.liquid`. */
|
|
24
|
-
path: string;
|
|
25
|
-
kind: 'layout' | 'module' | 'partial';
|
|
26
|
-
/** From an `@name` annotation. */
|
|
27
|
-
title?: string;
|
|
28
|
-
/** The keys of its `{% region %}` tags, in order. */
|
|
29
|
-
regions: string[];
|
|
30
|
-
variables: ViewVariable[];
|
|
31
|
-
}
|
|
32
|
-
export type ViewHint = 'output' | 'image' | 'date' | 'href' | 'condition' | 'case' | 'raw';
|
|
33
|
-
export interface ViewVariable {
|
|
34
|
-
key: string;
|
|
35
|
-
/**
|
|
36
|
-
* How the view uses it: printed (`{{ x }}`), in `{% image %}`, with a `date` filter, as a link's `href`, in
|
|
37
|
-
* a condition, in a `case`, as a block of HTML.
|
|
38
|
-
*/
|
|
39
|
-
hints: ViewHint[];
|
|
40
|
-
/** What the view reads from it: `x.url` reads `url`. */
|
|
41
|
-
properties: string[];
|
|
42
|
-
/** The values `{% when %}` compares it with, under `{% case %}`. */
|
|
43
|
-
options: string[];
|
|
44
|
-
/** When the view loops over it: what each item reads (`p.name` reads `name`). */
|
|
45
|
-
items?: ViewVariable[];
|
|
46
|
-
/** From an `@field` annotation: TEXT, TEXTBOX, RICH_TEXT, SELECT, CHECKBOX, DATE, IMAGE, DOCUMENT, LINK or CONTRIBUTOR. */
|
|
47
|
-
kind?: string;
|
|
48
|
-
/** From an `@field` annotation. */
|
|
49
|
-
label?: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ScanOptions {
|
|
52
|
-
/** Static globals the site's templates read, which aren't module values. */
|
|
53
|
-
globals?: string[];
|
|
54
|
-
}
|
|
55
|
-
/** The views folder and those of its subfolders that exist: the roots views are looked up in, in order. */
|
|
56
|
-
export declare function viewRoots(viewsPath: string): string[];
|
|
57
|
-
/** Reads every view in the folder (and its `layouts/`, `modules/` and `partials/`). */
|
|
58
|
-
export declare function scanViews(viewsPath: string, options?: ScanOptions): ViewManifest;
|
|
59
|
-
/** Where `GET /ceems/views` reads from, and the secret its tokens are signed with. */
|
|
60
|
-
export interface ViewsRouteConfig {
|
|
61
|
-
secret?: string;
|
|
62
|
-
viewsPath: string;
|
|
63
|
-
globals?: string[];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* `GET /ceems/views?token=…`: the views' manifest, for the editor. The token is a preview token signed for
|
|
67
|
-
* `VIEWS_TOKEN_SUBJECT`; the editor it names may read the response from the browser, which is how it reaches
|
|
68
|
-
* a site running on `localhost`. 404 without a preview secret, like drafts.
|
|
69
|
-
*/
|
|
70
|
-
export declare function viewsHandler(config: ViewsRouteConfig): express.RequestHandler;
|
|
71
|
-
/**
|
|
72
|
-
* `OPTIONS /ceems/views?token=…`: the browser's preflight. Chrome sends one before a public page (the editor)
|
|
73
|
-
* reads from a private address (`localhost`), and needs `Access-Control-Allow-Private-Network` back. Any page
|
|
74
|
-
* may make the request: only the editor a valid token names can read the views it returns.
|
|
75
|
-
*/
|
|
76
|
-
export declare function viewsPreflightHandler(): express.RequestHandler;
|
package/lib/views.js
DELETED
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VIEWS_TOKEN_SUBJECT = exports.VIEW_FOLDERS = void 0;
|
|
7
|
-
exports.viewRoots = viewRoots;
|
|
8
|
-
exports.scanViews = scanViews;
|
|
9
|
-
exports.viewsHandler = viewsHandler;
|
|
10
|
-
exports.viewsPreflightHandler = viewsPreflightHandler;
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const liquidjs_1 = require("liquidjs");
|
|
14
|
-
const preview_token_1 = require("./preview-token");
|
|
15
|
-
/**
|
|
16
|
-
* What a site's views need from the editor, read from their source: which are layouts (templates, with the
|
|
17
|
-
* regions they place) and which are modules (module types, with the values they read). Served to the Cee.ms
|
|
18
|
-
* editor at `GET /ceems/views`, which suggests templates and module types from it.
|
|
19
|
-
*
|
|
20
|
-
* Views can be grouped in folders, `layouts/`, `modules/` and `partials/`, which then decide what each one
|
|
21
|
-
* is. A site with none of them keeps every view at the top: a view with a `{% region %}` is a layout, and the
|
|
22
|
-
* rest are modules. Either way a view is named by its file name alone, as templates and modules refer to it.
|
|
23
|
-
*/
|
|
24
|
-
/** The folders views can be grouped in, in the order a name is looked up. */
|
|
25
|
-
exports.VIEW_FOLDERS = ['layouts', 'modules', 'partials'];
|
|
26
|
-
/** The page id the Cee.ms API signs a preview token with to read the views. */
|
|
27
|
-
exports.VIEWS_TOKEN_SUBJECT = 'ceems:views';
|
|
28
|
-
/**
|
|
29
|
-
* What every template can read that isn't a module's own value: the published site's keys, the render's, and
|
|
30
|
-
* the `blog` a `{% blog %}` tag renders with. Not `people`: modules often have a field of that name, which
|
|
31
|
-
* their values then shadow.
|
|
32
|
-
*/
|
|
33
|
-
const GLOBALS = [
|
|
34
|
-
'page',
|
|
35
|
-
'site',
|
|
36
|
-
'settings',
|
|
37
|
-
'pages',
|
|
38
|
-
'pageIndex',
|
|
39
|
-
'documents',
|
|
40
|
-
'collections',
|
|
41
|
-
'navigation',
|
|
42
|
-
'attributes',
|
|
43
|
-
'metadata',
|
|
44
|
-
'blogs',
|
|
45
|
-
'blog',
|
|
46
|
-
'modules',
|
|
47
|
-
'regions',
|
|
48
|
-
'forloop',
|
|
49
|
-
'tablerowloop',
|
|
50
|
-
];
|
|
51
|
-
const KEYWORDS = new Set(['and', 'or', 'contains', 'true', 'false', 'nil', 'null', 'empty', 'blank', 'in']);
|
|
52
|
-
const BLOCK_TAGS = 'div|section|article|main|aside|blockquote|li|td';
|
|
53
|
-
/** The views folder and those of its subfolders that exist: the roots views are looked up in, in order. */
|
|
54
|
-
function viewRoots(viewsPath) {
|
|
55
|
-
const root = path_1.default.resolve(viewsPath);
|
|
56
|
-
const folders = exports.VIEW_FOLDERS.map((folder) => path_1.default.join(root, folder)).filter((dir) => fs_1.default.existsSync(dir) && fs_1.default.statSync(dir).isDirectory());
|
|
57
|
-
return [root, ...folders];
|
|
58
|
-
}
|
|
59
|
-
/** Reads every view in the folder (and its `layouts/`, `modules/` and `partials/`). */
|
|
60
|
-
function scanViews(viewsPath, options = {}) {
|
|
61
|
-
const root = path_1.default.resolve(viewsPath);
|
|
62
|
-
const globals = new Set([...GLOBALS, ...(options.globals || [])]);
|
|
63
|
-
const foldered = viewRoots(root).length > 1;
|
|
64
|
-
const views = [];
|
|
65
|
-
const warnings = [];
|
|
66
|
-
const seen = new Map();
|
|
67
|
-
for (const dir of viewRoots(root)) {
|
|
68
|
-
const folder = path_1.default.relative(root, dir);
|
|
69
|
-
const files = fs_1.default
|
|
70
|
-
.readdirSync(dir)
|
|
71
|
-
.filter((file) => file.endsWith('.liquid') && fs_1.default.statSync(path_1.default.join(dir, file)).isFile())
|
|
72
|
-
.sort();
|
|
73
|
-
for (const file of files) {
|
|
74
|
-
const name = file.slice(0, -'.liquid'.length);
|
|
75
|
-
const relative = folder ? `${folder}/${file}` : file;
|
|
76
|
-
const first = seen.get(name);
|
|
77
|
-
if (first) {
|
|
78
|
-
warnings.push(`\`${name}\` is in both ${first} and ${relative}: only ${first} renders`);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
seen.set(name, relative);
|
|
82
|
-
const scanned = scanView(fs_1.default.readFileSync(path_1.default.join(dir, file), 'utf8'), globals);
|
|
83
|
-
let kind;
|
|
84
|
-
if (folder === 'layouts')
|
|
85
|
-
kind = 'layout';
|
|
86
|
-
else if (folder === 'modules')
|
|
87
|
-
kind = 'module';
|
|
88
|
-
else if (folder === 'partials' || foldered)
|
|
89
|
-
kind = 'partial';
|
|
90
|
-
else
|
|
91
|
-
kind = scanned.regions.length ? 'layout' : 'module';
|
|
92
|
-
views.push({
|
|
93
|
-
name,
|
|
94
|
-
path: relative,
|
|
95
|
-
kind,
|
|
96
|
-
...(scanned.title ? { title: scanned.title } : {}),
|
|
97
|
-
regions: scanned.regions,
|
|
98
|
-
variables: scanned.variables,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return { version: 1, views, warnings };
|
|
103
|
-
}
|
|
104
|
-
let reads = 0;
|
|
105
|
-
const gathered = (key) => ({ key, hints: new Set(), properties: new Set(), options: new Set() });
|
|
106
|
-
function entry(map, key) {
|
|
107
|
-
let found = map.get(key);
|
|
108
|
-
if (!found)
|
|
109
|
-
map.set(key, (found = gathered(key)));
|
|
110
|
-
return found;
|
|
111
|
-
}
|
|
112
|
-
function finish(map) {
|
|
113
|
-
const order = (v) => v.seen ?? Infinity;
|
|
114
|
-
return [...map.values()]
|
|
115
|
-
.sort((a, b) => order(a) - order(b))
|
|
116
|
-
.map((v) => ({
|
|
117
|
-
key: v.key,
|
|
118
|
-
hints: [...v.hints],
|
|
119
|
-
properties: [...v.properties],
|
|
120
|
-
options: [...v.options],
|
|
121
|
-
...(v.items ? { items: finish(v.items) } : {}),
|
|
122
|
-
...(v.kind ? { kind: v.kind } : {}),
|
|
123
|
-
...(v.label ? { label: v.label } : {}),
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
/** Removes quoted strings, so what's left is identifiers, operators and numbers. */
|
|
127
|
-
const unquote = (source) => source.replace(/'[^']*'|"[^"]*"/g, '""');
|
|
128
|
-
/** Splits on `|` outside quotes: the expression, then each filter with its arguments. */
|
|
129
|
-
function splitFilters(source) {
|
|
130
|
-
const parts = [];
|
|
131
|
-
let current = '';
|
|
132
|
-
let quote = '';
|
|
133
|
-
for (const char of source) {
|
|
134
|
-
if (quote) {
|
|
135
|
-
if (char === quote)
|
|
136
|
-
quote = '';
|
|
137
|
-
}
|
|
138
|
-
else if (char === '"' || char === "'") {
|
|
139
|
-
quote = char;
|
|
140
|
-
}
|
|
141
|
-
else if (char === '|') {
|
|
142
|
-
parts.push(current);
|
|
143
|
-
current = '';
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
current += char;
|
|
147
|
-
}
|
|
148
|
-
parts.push(current);
|
|
149
|
-
return parts;
|
|
150
|
-
}
|
|
151
|
-
/** The variable paths in an expression. Named arguments (`key: value`) and keywords are left out. */
|
|
152
|
-
function pathsIn(source) {
|
|
153
|
-
const text = unquote(source.replace(/\[\s*(['"])([^'"]+)\1\s*\]/g, '.$2'));
|
|
154
|
-
const paths = [];
|
|
155
|
-
const pattern = /[A-Za-z_][\w-]*(?:\.[A-Za-z_][\w-]*)*/g;
|
|
156
|
-
for (const match of text.matchAll(pattern)) {
|
|
157
|
-
const before = text[match.index - 1];
|
|
158
|
-
if (before === '.' || (before && /[\w"]/.test(before)))
|
|
159
|
-
continue;
|
|
160
|
-
const after = text.slice(match.index + match[0].length).trimStart();
|
|
161
|
-
if (after.startsWith(':'))
|
|
162
|
-
continue;
|
|
163
|
-
const segments = match[0].split('.');
|
|
164
|
-
if (KEYWORDS.has(segments[0]))
|
|
165
|
-
continue;
|
|
166
|
-
paths.push(segments);
|
|
167
|
-
}
|
|
168
|
-
return paths;
|
|
169
|
-
}
|
|
170
|
-
/** An output or filtered value: its main path, the paths anywhere in it, and its filter names. */
|
|
171
|
-
function readValue(source) {
|
|
172
|
-
const [expression, ...filters] = splitFilters(source);
|
|
173
|
-
const main = pathsIn(expression);
|
|
174
|
-
return {
|
|
175
|
-
main: main.length === 1 ? main[0] : undefined,
|
|
176
|
-
paths: [...main, ...filters.flatMap((f) => pathsIn(f.replace(/^\s*[\w-]+/, '')))],
|
|
177
|
-
filters: filters.map((f) => f.trim().split(/[\s:]/)[0]),
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
/** The string literals in a `{% when %}`. */
|
|
181
|
-
const literals = (source) => [...source.matchAll(/'([^']*)'|"([^"]*)"/g)].map((m) => m[1] ?? m[2]);
|
|
182
|
-
function scanView(source, globals) {
|
|
183
|
-
const tokens = new liquidjs_1.Tokenizer(source).readTopLevelTokens();
|
|
184
|
-
const variables = new Map();
|
|
185
|
-
const regions = [];
|
|
186
|
-
let title;
|
|
187
|
-
// names the view sets itself aren't module values
|
|
188
|
-
const own = new Set();
|
|
189
|
-
for (const token of tokens) {
|
|
190
|
-
const tag = token;
|
|
191
|
-
if (tag.name === 'assign')
|
|
192
|
-
own.add(String(tag.args).split('=')[0].trim());
|
|
193
|
-
if (tag.name === 'capture')
|
|
194
|
-
own.add(String(tag.args)
|
|
195
|
-
.trim()
|
|
196
|
-
.replace(/^['"]|['"]$/g, ''));
|
|
197
|
-
}
|
|
198
|
-
/** What each loop's local is an item of: a top-level variable, or `null` (a global, or nested). */
|
|
199
|
-
const loops = [];
|
|
200
|
-
/** Records a use of a path; returns the variable it names, or `null` for a global or the view's own. */
|
|
201
|
-
const use = (segments, hint) => {
|
|
202
|
-
const [root, property, deeper] = segments;
|
|
203
|
-
const loop = [...loops].reverse().find((l) => l.local === root);
|
|
204
|
-
let target;
|
|
205
|
-
let read;
|
|
206
|
-
if (loop) {
|
|
207
|
-
if (!loop.of || !property)
|
|
208
|
-
return null;
|
|
209
|
-
loop.of.items ??= new Map();
|
|
210
|
-
target = entry(loop.of.items, property);
|
|
211
|
-
read = deeper;
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
if (globals.has(root) || own.has(root))
|
|
215
|
-
return null;
|
|
216
|
-
target = entry(variables, root);
|
|
217
|
-
read = property;
|
|
218
|
-
}
|
|
219
|
-
if (read)
|
|
220
|
-
target.properties.add(read);
|
|
221
|
-
if (hint)
|
|
222
|
-
target.hints.add(hint);
|
|
223
|
-
target.seen ??= ++reads;
|
|
224
|
-
return target;
|
|
225
|
-
};
|
|
226
|
-
let skipping = null;
|
|
227
|
-
let casing = null;
|
|
228
|
-
tokens.forEach((token, index) => {
|
|
229
|
-
const tag = token;
|
|
230
|
-
const name = tag.name;
|
|
231
|
-
if (skipping) {
|
|
232
|
-
if (name === 'end' + skipping)
|
|
233
|
-
skipping = null;
|
|
234
|
-
else if (skipping === 'comment' && tag.kind === liquidjs_1.TokenKind.HTML) {
|
|
235
|
-
title = annotate(tag.getContent(), variables) ?? title;
|
|
236
|
-
}
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
// an output: `{{ … }}`
|
|
240
|
-
if (tag.kind === liquidjs_1.TokenKind.Output) {
|
|
241
|
-
const value = readValue(tag.content);
|
|
242
|
-
const before = htmlAt(tokens, index - 1);
|
|
243
|
-
const after = htmlAt(tokens, index + 1);
|
|
244
|
-
for (const segments of value.paths) {
|
|
245
|
-
const variable = use(segments, 'output');
|
|
246
|
-
if (!variable || segments !== value.main)
|
|
247
|
-
continue;
|
|
248
|
-
if (value.filters.includes('date'))
|
|
249
|
-
variable.hints.add('date');
|
|
250
|
-
if (/href=["']?$/i.test(before))
|
|
251
|
-
variable.hints.add('href');
|
|
252
|
-
const open = before.match(new RegExp(`<(${BLOCK_TAGS})\\b[^>]*>\\s*$`, 'i'));
|
|
253
|
-
if (open && new RegExp(`^\\s*</${open[1]}\\s*>`, 'i').test(after))
|
|
254
|
-
variable.hints.add('raw');
|
|
255
|
-
}
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (tag.kind !== liquidjs_1.TokenKind.Tag)
|
|
259
|
-
return;
|
|
260
|
-
const args = String(tag.args || '');
|
|
261
|
-
switch (name) {
|
|
262
|
-
case 'raw':
|
|
263
|
-
case 'comment':
|
|
264
|
-
skipping = name;
|
|
265
|
-
break;
|
|
266
|
-
case 'region': {
|
|
267
|
-
const key = args.trim().replace(/^['"]|['"]$/g, '');
|
|
268
|
-
if (key && !regions.includes(key))
|
|
269
|
-
regions.push(key);
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
case 'if':
|
|
273
|
-
case 'elsif':
|
|
274
|
-
case 'unless':
|
|
275
|
-
for (const segments of pathsIn(args))
|
|
276
|
-
use(segments, 'condition');
|
|
277
|
-
break;
|
|
278
|
-
case 'case': {
|
|
279
|
-
const [segments] = pathsIn(args);
|
|
280
|
-
casing = segments ? use(segments, 'case') : null;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
case 'when':
|
|
284
|
-
for (const value of literals(args))
|
|
285
|
-
casing?.options.add(value);
|
|
286
|
-
for (const segments of pathsIn(args))
|
|
287
|
-
use(segments);
|
|
288
|
-
break;
|
|
289
|
-
case 'endcase':
|
|
290
|
-
casing = null;
|
|
291
|
-
break;
|
|
292
|
-
case 'for':
|
|
293
|
-
case 'tablerow': {
|
|
294
|
-
const match = args.match(/^\s*([\w-]+)\s+in\s+(.+)$/);
|
|
295
|
-
if (!match)
|
|
296
|
-
break;
|
|
297
|
-
const [segments, ...rest] = pathsIn(match[2]);
|
|
298
|
-
let of = null;
|
|
299
|
-
if (segments) {
|
|
300
|
-
const variable = use(segments);
|
|
301
|
-
// only a loop straight over a top-level value gives its items
|
|
302
|
-
if (variable && segments.length === 1 && variables.get(segments[0]) === variable)
|
|
303
|
-
of = variable;
|
|
304
|
-
}
|
|
305
|
-
for (const other of rest)
|
|
306
|
-
use(other);
|
|
307
|
-
loops.push({ local: match[1], of });
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
case 'endfor':
|
|
311
|
-
case 'endtablerow':
|
|
312
|
-
loops.pop();
|
|
313
|
-
break;
|
|
314
|
-
case 'image':
|
|
315
|
-
case 'imageurl': {
|
|
316
|
-
// the rest are size names
|
|
317
|
-
const [segments] = pathsIn(args.trim().split(/\s+/)[0] || '');
|
|
318
|
-
if (segments)
|
|
319
|
-
use(segments, 'image');
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
case 'assign':
|
|
323
|
-
for (const segments of readValue(args.slice(args.indexOf('=') + 1)).paths)
|
|
324
|
-
use(segments);
|
|
325
|
-
break;
|
|
326
|
-
case 'echo':
|
|
327
|
-
for (const segments of readValue(args).paths)
|
|
328
|
-
use(segments, 'output');
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
return { title, regions, variables: finish(variables) };
|
|
333
|
-
}
|
|
334
|
-
/** The HTML of the token at `index`, or `''`. */
|
|
335
|
-
function htmlAt(tokens, index) {
|
|
336
|
-
const token = tokens[index];
|
|
337
|
-
return token?.kind === liquidjs_1.TokenKind.HTML ? token.getContent() : '';
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Reads `@name Team members` and `@field <key> <KIND> [label]` lines (`@field people.name TEXT Name` for an
|
|
341
|
-
* item's value). Returns the name, if one is given.
|
|
342
|
-
*/
|
|
343
|
-
function annotate(text, variables) {
|
|
344
|
-
let title;
|
|
345
|
-
for (const line of text.split('\n').map((l) => l.trim())) {
|
|
346
|
-
const named = line.match(/^@name\s+(.+)$/);
|
|
347
|
-
if (named)
|
|
348
|
-
title = named[1].trim();
|
|
349
|
-
const field = line.match(/^@field\s+([\w.-]+)\s+([A-Z_]+)(?:\s+(.+))?$/);
|
|
350
|
-
if (field) {
|
|
351
|
-
const [root, item] = field[1].split('.');
|
|
352
|
-
let target = entry(variables, root);
|
|
353
|
-
if (item) {
|
|
354
|
-
target.items ??= new Map();
|
|
355
|
-
target = entry(target.items, item);
|
|
356
|
-
}
|
|
357
|
-
target.kind = field[2];
|
|
358
|
-
if (field[3])
|
|
359
|
-
target.label = field[3].trim();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return title;
|
|
363
|
-
}
|
|
364
|
-
let packageInfo;
|
|
365
|
-
/** This package's name and version, from its `package.json` (beside both `src/` and `lib/`). */
|
|
366
|
-
function packageOf() {
|
|
367
|
-
if (!packageInfo) {
|
|
368
|
-
const json = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../package.json'), 'utf8'));
|
|
369
|
-
packageInfo = { name: json.name, version: json.version };
|
|
370
|
-
}
|
|
371
|
-
return packageInfo;
|
|
372
|
-
}
|
|
373
|
-
/** The editor origin a valid views token names, or `null` if the token isn't valid. */
|
|
374
|
-
function verifiedOrigin(secret, token) {
|
|
375
|
-
const verified = (0, preview_token_1.verifyPreviewToken)(secret, String(token || ''), exports.VIEWS_TOKEN_SUBJECT);
|
|
376
|
-
return verified.ok ? verified.payload.o || '' : null;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* `GET /ceems/views?token=…`: the views' manifest, for the editor. The token is a preview token signed for
|
|
380
|
-
* `VIEWS_TOKEN_SUBJECT`; the editor it names may read the response from the browser, which is how it reaches
|
|
381
|
-
* a site running on `localhost`. 404 without a preview secret, like drafts.
|
|
382
|
-
*/
|
|
383
|
-
function viewsHandler(config) {
|
|
384
|
-
return (req, res) => {
|
|
385
|
-
res.set({ 'Cache-Control': 'no-store', Vary: 'Origin' });
|
|
386
|
-
// Refusals carry nothing, so any page may read them: the editor can then say what to fix.
|
|
387
|
-
if (!config.secret) {
|
|
388
|
-
res.set('Access-Control-Allow-Origin', '*').status(404).send('Not found');
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const origin = verifiedOrigin(config.secret, req.query.token);
|
|
392
|
-
if (origin === null) {
|
|
393
|
-
res.set('Access-Control-Allow-Origin', '*').status(401).send('Unauthorized');
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
if (origin && req.get('origin') === origin)
|
|
397
|
-
res.set('Access-Control-Allow-Origin', origin);
|
|
398
|
-
res.json({
|
|
399
|
-
...scanViews(config.viewsPath, { globals: config.globals }),
|
|
400
|
-
package: packageOf(),
|
|
401
|
-
});
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* `OPTIONS /ceems/views?token=…`: the browser's preflight. Chrome sends one before a public page (the editor)
|
|
406
|
-
* reads from a private address (`localhost`), and needs `Access-Control-Allow-Private-Network` back. Any page
|
|
407
|
-
* may make the request: only the editor a valid token names can read the views it returns.
|
|
408
|
-
*/
|
|
409
|
-
function viewsPreflightHandler() {
|
|
410
|
-
return (req, res) => {
|
|
411
|
-
res.set('Vary', 'Origin');
|
|
412
|
-
const origin = req.get('origin');
|
|
413
|
-
if (!origin) {
|
|
414
|
-
res.status(400).end();
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
res.set({
|
|
418
|
-
'Access-Control-Allow-Origin': origin,
|
|
419
|
-
'Access-Control-Allow-Methods': 'GET',
|
|
420
|
-
'Access-Control-Allow-Private-Network': 'true',
|
|
421
|
-
'Access-Control-Max-Age': '600',
|
|
422
|
-
});
|
|
423
|
-
res.status(204).end();
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
//# sourceMappingURL=views.js.map
|
package/lib/views.js.map
DELETED
|
@@ -1 +0,0 @@
|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