@lolyjs/core 0.3.0-alpha.3 → 0.3.0-alpha.5
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/cli.cjs +40 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +40 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +162 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +162 -125
- package/dist/index.mjs.map +1 -1
- package/dist/runtime.cjs +118 -116
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.mjs +118 -116
- package/dist/runtime.mjs.map +1 -1
- package/package.json +1 -1
package/dist/runtime.mjs
CHANGED
|
@@ -128,132 +128,134 @@ function getOrCreateLink(rel, href) {
|
|
|
128
128
|
}
|
|
129
129
|
function applyMetadata(md) {
|
|
130
130
|
if (!md) return;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (md.description) {
|
|
135
|
-
const meta = getOrCreateMeta('meta[name="description"]', { name: "description" });
|
|
136
|
-
meta.content = md.description;
|
|
137
|
-
}
|
|
138
|
-
if (md.robots) {
|
|
139
|
-
const meta = getOrCreateMeta('meta[name="robots"]', { name: "robots" });
|
|
140
|
-
meta.content = md.robots;
|
|
141
|
-
}
|
|
142
|
-
if (md.themeColor) {
|
|
143
|
-
const meta = getOrCreateMeta('meta[name="theme-color"]', { name: "theme-color" });
|
|
144
|
-
meta.content = md.themeColor;
|
|
145
|
-
}
|
|
146
|
-
if (md.viewport) {
|
|
147
|
-
const meta = getOrCreateMeta('meta[name="viewport"]', { name: "viewport" });
|
|
148
|
-
meta.content = md.viewport;
|
|
149
|
-
}
|
|
150
|
-
if (md.canonical) {
|
|
151
|
-
getOrCreateLink("canonical", md.canonical);
|
|
152
|
-
}
|
|
153
|
-
if (md.openGraph) {
|
|
154
|
-
const og = md.openGraph;
|
|
155
|
-
if (og.title) {
|
|
156
|
-
const meta = getOrCreateMeta('meta[property="og:title"]', { property: "og:title" });
|
|
157
|
-
meta.content = og.title;
|
|
158
|
-
}
|
|
159
|
-
if (og.description) {
|
|
160
|
-
const meta = getOrCreateMeta('meta[property="og:description"]', { property: "og:description" });
|
|
161
|
-
meta.content = og.description;
|
|
162
|
-
}
|
|
163
|
-
if (og.type) {
|
|
164
|
-
const meta = getOrCreateMeta('meta[property="og:type"]', { property: "og:type" });
|
|
165
|
-
meta.content = og.type;
|
|
166
|
-
}
|
|
167
|
-
if (og.url) {
|
|
168
|
-
const meta = getOrCreateMeta('meta[property="og:url"]', { property: "og:url" });
|
|
169
|
-
meta.content = og.url;
|
|
170
|
-
}
|
|
171
|
-
if (og.image) {
|
|
172
|
-
if (typeof og.image === "string") {
|
|
173
|
-
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
174
|
-
meta.content = og.image;
|
|
175
|
-
} else {
|
|
176
|
-
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
177
|
-
meta.content = og.image.url;
|
|
178
|
-
if (og.image.width) {
|
|
179
|
-
const metaWidth = getOrCreateMeta('meta[property="og:image:width"]', { property: "og:image:width" });
|
|
180
|
-
metaWidth.content = String(og.image.width);
|
|
181
|
-
}
|
|
182
|
-
if (og.image.height) {
|
|
183
|
-
const metaHeight = getOrCreateMeta('meta[property="og:image:height"]', { property: "og:image:height" });
|
|
184
|
-
metaHeight.content = String(og.image.height);
|
|
185
|
-
}
|
|
186
|
-
if (og.image.alt) {
|
|
187
|
-
const metaAlt = getOrCreateMeta('meta[property="og:image:alt"]', { property: "og:image:alt" });
|
|
188
|
-
metaAlt.content = og.image.alt;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
if (md.title) {
|
|
133
|
+
document.title = md.title;
|
|
191
134
|
}
|
|
192
|
-
if (
|
|
193
|
-
const meta = getOrCreateMeta('meta[
|
|
194
|
-
meta.content =
|
|
135
|
+
if (md.description) {
|
|
136
|
+
const meta = getOrCreateMeta('meta[name="description"]', { name: "description" });
|
|
137
|
+
meta.content = md.description;
|
|
195
138
|
}
|
|
196
|
-
if (
|
|
197
|
-
const meta = getOrCreateMeta('meta[
|
|
198
|
-
meta.content =
|
|
139
|
+
if (md.robots) {
|
|
140
|
+
const meta = getOrCreateMeta('meta[name="robots"]', { name: "robots" });
|
|
141
|
+
meta.content = md.robots;
|
|
199
142
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (twitter.card) {
|
|
204
|
-
const meta = getOrCreateMeta('meta[name="twitter:card"]', { name: "twitter:card" });
|
|
205
|
-
meta.content = twitter.card;
|
|
143
|
+
if (md.themeColor) {
|
|
144
|
+
const meta = getOrCreateMeta('meta[name="theme-color"]', { name: "theme-color" });
|
|
145
|
+
meta.content = md.themeColor;
|
|
206
146
|
}
|
|
207
|
-
if (
|
|
208
|
-
const meta = getOrCreateMeta('meta[name="
|
|
209
|
-
meta.content =
|
|
147
|
+
if (md.viewport) {
|
|
148
|
+
const meta = getOrCreateMeta('meta[name="viewport"]', { name: "viewport" });
|
|
149
|
+
meta.content = md.viewport;
|
|
210
150
|
}
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
meta.content = twitter.description;
|
|
151
|
+
if (md.canonical) {
|
|
152
|
+
getOrCreateLink("canonical", md.canonical);
|
|
214
153
|
}
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
|
|
154
|
+
if (md.openGraph) {
|
|
155
|
+
const og = md.openGraph;
|
|
156
|
+
if (og.title) {
|
|
157
|
+
const meta = getOrCreateMeta('meta[property="og:title"]', { property: "og:title" });
|
|
158
|
+
meta.content = og.title;
|
|
159
|
+
}
|
|
160
|
+
if (og.description) {
|
|
161
|
+
const meta = getOrCreateMeta('meta[property="og:description"]', { property: "og:description" });
|
|
162
|
+
meta.content = og.description;
|
|
163
|
+
}
|
|
164
|
+
if (og.type) {
|
|
165
|
+
const meta = getOrCreateMeta('meta[property="og:type"]', { property: "og:type" });
|
|
166
|
+
meta.content = og.type;
|
|
167
|
+
}
|
|
168
|
+
if (og.url) {
|
|
169
|
+
const meta = getOrCreateMeta('meta[property="og:url"]', { property: "og:url" });
|
|
170
|
+
meta.content = og.url;
|
|
171
|
+
}
|
|
172
|
+
if (og.image) {
|
|
173
|
+
if (typeof og.image === "string") {
|
|
174
|
+
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
175
|
+
meta.content = og.image;
|
|
176
|
+
} else {
|
|
177
|
+
const meta = getOrCreateMeta('meta[property="og:image"]', { property: "og:image" });
|
|
178
|
+
meta.content = og.image.url;
|
|
179
|
+
if (og.image.width) {
|
|
180
|
+
const metaWidth = getOrCreateMeta('meta[property="og:image:width"]', { property: "og:image:width" });
|
|
181
|
+
metaWidth.content = String(og.image.width);
|
|
182
|
+
}
|
|
183
|
+
if (og.image.height) {
|
|
184
|
+
const metaHeight = getOrCreateMeta('meta[property="og:image:height"]', { property: "og:image:height" });
|
|
185
|
+
metaHeight.content = String(og.image.height);
|
|
186
|
+
}
|
|
187
|
+
if (og.image.alt) {
|
|
188
|
+
const metaAlt = getOrCreateMeta('meta[property="og:image:alt"]', { property: "og:image:alt" });
|
|
189
|
+
metaAlt.content = og.image.alt;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (og.siteName) {
|
|
194
|
+
const meta = getOrCreateMeta('meta[property="og:site_name"]', { property: "og:site_name" });
|
|
195
|
+
meta.content = og.siteName;
|
|
196
|
+
}
|
|
197
|
+
if (og.locale) {
|
|
198
|
+
const meta = getOrCreateMeta('meta[property="og:locale"]', { property: "og:locale" });
|
|
199
|
+
meta.content = og.locale;
|
|
200
|
+
}
|
|
218
201
|
}
|
|
219
|
-
if (twitter
|
|
220
|
-
const
|
|
221
|
-
|
|
202
|
+
if (md.twitter) {
|
|
203
|
+
const twitter = md.twitter;
|
|
204
|
+
if (twitter.card) {
|
|
205
|
+
const meta = getOrCreateMeta('meta[name="twitter:card"]', { name: "twitter:card" });
|
|
206
|
+
meta.content = twitter.card;
|
|
207
|
+
}
|
|
208
|
+
if (twitter.title) {
|
|
209
|
+
const meta = getOrCreateMeta('meta[name="twitter:title"]', { name: "twitter:title" });
|
|
210
|
+
meta.content = twitter.title;
|
|
211
|
+
}
|
|
212
|
+
if (twitter.description) {
|
|
213
|
+
const meta = getOrCreateMeta('meta[name="twitter:description"]', { name: "twitter:description" });
|
|
214
|
+
meta.content = twitter.description;
|
|
215
|
+
}
|
|
216
|
+
if (twitter.image) {
|
|
217
|
+
const meta = getOrCreateMeta('meta[name="twitter:image"]', { name: "twitter:image" });
|
|
218
|
+
meta.content = twitter.image;
|
|
219
|
+
}
|
|
220
|
+
if (twitter.imageAlt) {
|
|
221
|
+
const meta = getOrCreateMeta('meta[name="twitter:image:alt"]', { name: "twitter:image:alt" });
|
|
222
|
+
meta.content = twitter.imageAlt;
|
|
223
|
+
}
|
|
224
|
+
if (twitter.site) {
|
|
225
|
+
const meta = getOrCreateMeta('meta[name="twitter:site"]', { name: "twitter:site" });
|
|
226
|
+
meta.content = twitter.site;
|
|
227
|
+
}
|
|
228
|
+
if (twitter.creator) {
|
|
229
|
+
const meta = getOrCreateMeta('meta[name="twitter:creator"]', { name: "twitter:creator" });
|
|
230
|
+
meta.content = twitter.creator;
|
|
231
|
+
}
|
|
222
232
|
}
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
|
|
233
|
+
if (md.metaTags && Array.isArray(md.metaTags)) {
|
|
234
|
+
md.metaTags.forEach((tag) => {
|
|
235
|
+
let selector = "";
|
|
236
|
+
if (tag.name) {
|
|
237
|
+
selector = `meta[name="${tag.name}"]`;
|
|
238
|
+
} else if (tag.property) {
|
|
239
|
+
selector = `meta[property="${tag.property}"]`;
|
|
240
|
+
} else if (tag.httpEquiv) {
|
|
241
|
+
selector = `meta[http-equiv="${tag.httpEquiv}"]`;
|
|
242
|
+
}
|
|
243
|
+
if (selector) {
|
|
244
|
+
const meta = getOrCreateMeta(selector, {
|
|
245
|
+
name: tag.name,
|
|
246
|
+
property: tag.property,
|
|
247
|
+
httpEquiv: tag.httpEquiv
|
|
248
|
+
});
|
|
249
|
+
meta.content = tag.content;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
226
252
|
}
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
|
|
253
|
+
if (md.links && Array.isArray(md.links)) {
|
|
254
|
+
md.links.forEach((link) => {
|
|
255
|
+
getOrCreateLink(link.rel, link.href);
|
|
256
|
+
});
|
|
230
257
|
}
|
|
231
|
-
}
|
|
232
|
-
if (md.metaTags && Array.isArray(md.metaTags)) {
|
|
233
|
-
md.metaTags.forEach((tag) => {
|
|
234
|
-
let selector = "";
|
|
235
|
-
if (tag.name) {
|
|
236
|
-
selector = `meta[name="${tag.name}"]`;
|
|
237
|
-
} else if (tag.property) {
|
|
238
|
-
selector = `meta[property="${tag.property}"]`;
|
|
239
|
-
} else if (tag.httpEquiv) {
|
|
240
|
-
selector = `meta[http-equiv="${tag.httpEquiv}"]`;
|
|
241
|
-
}
|
|
242
|
-
if (selector) {
|
|
243
|
-
const meta = getOrCreateMeta(selector, {
|
|
244
|
-
name: tag.name,
|
|
245
|
-
property: tag.property,
|
|
246
|
-
httpEquiv: tag.httpEquiv
|
|
247
|
-
});
|
|
248
|
-
meta.content = tag.content;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
if (md.links && Array.isArray(md.links)) {
|
|
253
|
-
md.links.forEach((link) => {
|
|
254
|
-
getOrCreateLink(link.rel, link.href);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
258
|
+
});
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
// modules/runtime/client/AppShell.tsx
|