@documental-xyz/core 0.1.0 → 0.1.1
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/integration.ts +3 -0
- package/package.json +5 -5
- package/src/content/pages/{teste-layout.md → exemple.md} +4 -4
- package/src/vite/yaml-merge-plugin.ts +25 -1
- package/src/content/pages/alter-ameacada.md +0 -80
- package/src/content/pages/expulsions.md +0 -1447
- package/src/content/pages/home.md +0 -346
- package/src/content/pages/nhanderekoa-studio-autonoma.md +0 -3113
- package/src/content/pages/nhanderekoa-terra-ind/303/255gena-jaragu/303/241.md +0 -3806
- package/src/content/pages/nova-landing-page.md +0 -546
- package/src/content/pages/territ/303/263rios-de-exce/303/247/303/243o.md +0 -2199
- package/src/content/pages/teste-alter-do-chao.md +0 -955
- package/src/content/pages/thiago.md +0 -93
package/integration.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface CoreOptions {
|
|
|
22
22
|
mediaFolder?: string;
|
|
23
23
|
/** Public folder URL prefix (default 'uploads') */
|
|
24
24
|
publicFolder?: string;
|
|
25
|
+
/** Pages collection folder path (default 'src/content/pages') */
|
|
26
|
+
pagesFolder?: string;
|
|
25
27
|
/** Site URL override (fallback: process.env.SITE) */
|
|
26
28
|
site?: string;
|
|
27
29
|
/** Base path override (fallback: process.env.BASE_PATH) */
|
|
@@ -100,6 +102,7 @@ export default function core(options: CoreOptions): AstroIntegration {
|
|
|
100
102
|
authBaseUrl: options.authBaseUrl,
|
|
101
103
|
mediaFolder: options.mediaFolder,
|
|
102
104
|
publicFolder: options.publicFolder,
|
|
105
|
+
pagesFolder: options.pagesFolder,
|
|
103
106
|
}),
|
|
104
107
|
],
|
|
105
108
|
resolve: {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@documental-xyz/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"description": "Documental Core — geo-narrative static sites with CMS",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -50,12 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"astro-icon": "^0.8.1",
|
|
53
|
+
"glob": "^10.5.0",
|
|
53
54
|
"gray-matter": "^4.0.3",
|
|
55
|
+
"js-yaml": "^4.3.0",
|
|
54
56
|
"marked": ">=5.0.2",
|
|
55
57
|
"marked-gfm-heading-id": ">=3.1.2",
|
|
56
58
|
"marked-mangle": ">=1.1.6",
|
|
57
|
-
"sass-embedded": "^1.86.3",
|
|
58
59
|
"sass": "^1.80.5",
|
|
60
|
+
"sass-embedded": "^1.86.3",
|
|
59
61
|
"svelte": ">=4.0.0",
|
|
60
62
|
"swiper": "^11.1.14"
|
|
61
63
|
},
|
|
@@ -70,8 +72,6 @@
|
|
|
70
72
|
"eslint": "^9.16.0",
|
|
71
73
|
"eslint-config-prettier": "^9.1.0",
|
|
72
74
|
"eslint-plugin-prettier": "^5.2.1",
|
|
73
|
-
"glob": "^10.3.10",
|
|
74
|
-
"js-yaml": "^4.1.0",
|
|
75
75
|
"prettier": "^3.4.1",
|
|
76
76
|
"serve": "^14.2.4",
|
|
77
77
|
"stylelint": "^16.11.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Teste Layout
|
|
3
|
-
slug:
|
|
3
|
+
slug: home
|
|
4
4
|
pageSettings:
|
|
5
5
|
language: pt-BR
|
|
6
|
-
link_pt_br: /
|
|
7
|
-
link_en: /
|
|
8
|
-
link_es: /
|
|
6
|
+
link_pt_br: /home
|
|
7
|
+
link_en: /home-en
|
|
8
|
+
link_es: /home-es
|
|
9
9
|
animations: enable_all
|
|
10
10
|
direction: right
|
|
11
11
|
seoTitle: ''
|
|
@@ -52,6 +52,8 @@ export interface YamlMergePluginOptions {
|
|
|
52
52
|
mediaFolder?: string;
|
|
53
53
|
/** CMS public_folder. Defaults to `'uploads'`. Substitutes `${PUBLIC_FOLDER}`. */
|
|
54
54
|
publicFolder?: string;
|
|
55
|
+
/** Pages collection folder path. Defaults to `'src/content/pages'`. Substitutes `${PAGES_FOLDER}`. */
|
|
56
|
+
pagesFolder?: string;
|
|
55
57
|
/**
|
|
56
58
|
* Override the core package root for template resolution.
|
|
57
59
|
* Defaults to `CORE_ROOT` (resolved from this module's location).
|
|
@@ -67,6 +69,7 @@ interface ResolvedOptions {
|
|
|
67
69
|
authBaseUrl: string;
|
|
68
70
|
mediaFolder: string;
|
|
69
71
|
publicFolder: string;
|
|
72
|
+
pagesFolder: string;
|
|
70
73
|
coreRoot: string;
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -75,6 +78,7 @@ export const YAML_MERGE_DEFAULTS = {
|
|
|
75
78
|
branch: 'main',
|
|
76
79
|
mediaFolder: 'public/uploads',
|
|
77
80
|
publicFolder: 'uploads',
|
|
81
|
+
pagesFolder: 'src/content/pages',
|
|
78
82
|
} as const;
|
|
79
83
|
|
|
80
84
|
function resolveOptions(opts: YamlMergePluginOptions): ResolvedOptions {
|
|
@@ -89,6 +93,7 @@ function resolveOptions(opts: YamlMergePluginOptions): ResolvedOptions {
|
|
|
89
93
|
authBaseUrl: opts.authBaseUrl ?? '',
|
|
90
94
|
mediaFolder: opts.mediaFolder ?? YAML_MERGE_DEFAULTS.mediaFolder,
|
|
91
95
|
publicFolder: opts.publicFolder ?? YAML_MERGE_DEFAULTS.publicFolder,
|
|
96
|
+
pagesFolder: opts.pagesFolder ?? YAML_MERGE_DEFAULTS.pagesFolder,
|
|
92
97
|
coreRoot: opts.coreRoot ?? CORE_ROOT,
|
|
93
98
|
};
|
|
94
99
|
}
|
|
@@ -102,9 +107,27 @@ export function substitutePlaceholders(
|
|
|
102
107
|
text: string,
|
|
103
108
|
values: Record<string, string>
|
|
104
109
|
): string {
|
|
105
|
-
|
|
110
|
+
// First pass: remove entire lines where a placeholder is the sole value
|
|
111
|
+
// and the placeholder resolves to empty string (e.g. `base_url: ${AUTH_BASE_URL}`
|
|
112
|
+
// when AUTH_BASE_URL is unset → the line becomes `base_url: ` which YAML
|
|
113
|
+
// interprets as `null`, crashing Sveltia CMS).
|
|
114
|
+
let result = text.replace(
|
|
115
|
+
/^([ \t]*\w+:[\t ]*)\$\{([A-Z_][A-Z0-9_]*)\}[\t ]*$/gm,
|
|
116
|
+
(match, prefix, name) => {
|
|
117
|
+
if (
|
|
118
|
+
Object.prototype.hasOwnProperty.call(values, name) &&
|
|
119
|
+
values[name] === ''
|
|
120
|
+
) {
|
|
121
|
+
return ''; // Remove the line entirely
|
|
122
|
+
}
|
|
123
|
+
return match; // Leave it for the generic substitution below
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
// Second pass: substitute all remaining placeholders normally
|
|
127
|
+
result = result.replace(/\$\{([A-Z_][A-Z0-9_]*)\}/g, (match, name) =>
|
|
106
128
|
Object.prototype.hasOwnProperty.call(values, name) ? values[name] : match
|
|
107
129
|
);
|
|
130
|
+
return result;
|
|
108
131
|
}
|
|
109
132
|
|
|
110
133
|
/** Read a file, returning empty string if it does not exist. */
|
|
@@ -192,6 +215,7 @@ export async function buildMergedYamlText(
|
|
|
192
215
|
AUTH_BASE_URL: resolved.authBaseUrl,
|
|
193
216
|
MEDIA_FOLDER: resolved.mediaFolder,
|
|
194
217
|
PUBLIC_FOLDER: resolved.publicFolder,
|
|
218
|
+
PAGES_FOLDER: resolved.pagesFolder,
|
|
195
219
|
});
|
|
196
220
|
}
|
|
197
221
|
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Alter do chao
|
|
3
|
-
slug: alter-ameacada
|
|
4
|
-
pageSettings:
|
|
5
|
-
language: pt-BR
|
|
6
|
-
link_pt_br: /alter-ameacada
|
|
7
|
-
link_en: /alter-ameacada-en
|
|
8
|
-
link_es: /alter-ameacada-es
|
|
9
|
-
direction: left
|
|
10
|
-
seoTitle: ''
|
|
11
|
-
seoDescription: ''
|
|
12
|
-
animations: enable_all
|
|
13
|
-
pageTheme:
|
|
14
|
-
primaryColor: '#000009'
|
|
15
|
-
secondaryColor: '#f0ead9'
|
|
16
|
-
highlightColor: '#006949'
|
|
17
|
-
auxiliaryColor: '#6670ff'
|
|
18
|
-
displayFont: ''
|
|
19
|
-
textFont: ''
|
|
20
|
-
spacingPatterns:
|
|
21
|
-
- name: Teste
|
|
22
|
-
mobile: '10'
|
|
23
|
-
tablet: '11'
|
|
24
|
-
desktop: '12'
|
|
25
|
-
mapbox:
|
|
26
|
-
columnAlign: left
|
|
27
|
-
floatingText: false
|
|
28
|
-
style: mapbox://styles/comborari/ckr4wi3k80fpl17qo34th6kk2
|
|
29
|
-
center:
|
|
30
|
-
lng: -54.875
|
|
31
|
-
lat: -2.53
|
|
32
|
-
zoom: 1.1
|
|
33
|
-
bearing: 0
|
|
34
|
-
pitch: 0
|
|
35
|
-
layers: []
|
|
36
|
-
token: pk.eyJ1IjoiY29tYm9yYXJpIiwiYSI6ImNrcjR3OWczMjBhaWEyeHIyaWhwMnUzNHcifQ.Yv7o7kj1ImyC9Rn-egF0TQ
|
|
37
|
-
views:
|
|
38
|
-
- id: view_0
|
|
39
|
-
center:
|
|
40
|
-
lng: -58.911
|
|
41
|
-
lat: -6.315
|
|
42
|
-
duration: 4500
|
|
43
|
-
zoom: 4
|
|
44
|
-
bearing: 0
|
|
45
|
-
pitch: 0
|
|
46
|
-
mobile:
|
|
47
|
-
zoom: 3.5
|
|
48
|
-
captions:
|
|
49
|
-
title: false
|
|
50
|
-
notes: false
|
|
51
|
-
items:
|
|
52
|
-
- icon: <span class="material-symbols-outlined fill" style="color:white">show_chart</span>
|
|
53
|
-
text: Brazil's Legal Amazon
|
|
54
|
-
layers:
|
|
55
|
-
- amazonialegal
|
|
56
|
-
mapView: ''
|
|
57
|
-
components:
|
|
58
|
-
- type: Group
|
|
59
|
-
shortTitle: '-'
|
|
60
|
-
longTitle: '-'
|
|
61
|
-
description: ''
|
|
62
|
-
showInMenu: false
|
|
63
|
-
animations: false
|
|
64
|
-
id: '1'
|
|
65
|
-
layout: default
|
|
66
|
-
txtColor: Secondary
|
|
67
|
-
customTxtColor: ''
|
|
68
|
-
bgColor: Primary
|
|
69
|
-
customBgColor: ''
|
|
70
|
-
backgroundMedia: []
|
|
71
|
-
overlay: dark
|
|
72
|
-
components:
|
|
73
|
-
- type: HtmlEmbed
|
|
74
|
-
wideHtml: false
|
|
75
|
-
htmlCode: |-
|
|
76
|
-
<script>
|
|
77
|
-
window.location.href = "https://v1.documental.xyz/pt/alter-ameacada";
|
|
78
|
-
</script>
|
|
79
|
-
htmlCaption: ''
|
|
80
|
-
---
|