diff --git a/.changeset/chilly-plants-attack.md b/.changeset/chilly-plants-attack.md
new file mode 100644
index 000000000..767f50605
--- /dev/null
+++ b/.changeset/chilly-plants-attack.md
@@ -0,0 +1,5 @@
+---
+"marko": patch
+---
+
+Move body tag transform logic into translate.
diff --git a/.changeset/fancy-mammals-punch.md b/.changeset/fancy-mammals-punch.md
new file mode 100644
index 000000000..64e3f959c
--- /dev/null
+++ b/.changeset/fancy-mammals-punch.md
@@ -0,0 +1,5 @@
+---
+"@marko/compiler": patch
+---
+
+Default title tag to be text only for Marko 6.
diff --git a/.changeset/funky-clowns-shop.md b/.changeset/funky-clowns-shop.md
new file mode 100644
index 000000000..18b397ac8
--- /dev/null
+++ b/.changeset/funky-clowns-shop.md
@@ -0,0 +1,5 @@
+---
+"@marko/runtime-tags": patch
+---
+
+Move title tag logic into native tag translator.
diff --git a/.changeset/lemon-carpets-hunt.md b/.changeset/lemon-carpets-hunt.md
new file mode 100644
index 000000000..00a8cc1e5
--- /dev/null
+++ b/.changeset/lemon-carpets-hunt.md
@@ -0,0 +1,7 @@
+---
+"marko": patch
+"@marko/runtime-tags": patch
+"@marko/compiler": patch
+---
+
+Normalize taglib ids to be consistent with register ids and across Marko 5/6.
diff --git a/.changeset/stale-buttons-lead.md b/.changeset/stale-buttons-lead.md
new file mode 100644
index 000000000..b1c616377
--- /dev/null
+++ b/.changeset/stale-buttons-lead.md
@@ -0,0 +1,5 @@
+---
+"marko": patch
+---
+
+Merge migrate taglib into core taglib.
diff --git a/packages/compiler/src/taglib/index.js b/packages/compiler/src/taglib/index.js
index d6b580ce9..9b046ce56 100644
--- a/packages/compiler/src/taglib/index.js
+++ b/packages/compiler/src/taglib/index.js
@@ -19,9 +19,9 @@ const registeredTaglibs = [];
const loadedTranslatorsTaglibs = new Map();
let lookupCache = Object.create(null);
-register("marko/html", markoHTMLTaglib);
-register("marko/svg", markoSVGTaglib);
-register("marko/math", markoMathTaglib);
+register(markoHTMLTaglib["taglib-id"], markoHTMLTaglib);
+register(markoSVGTaglib["taglib-id"], markoSVGTaglib);
+register(markoMathTaglib["taglib-id"], markoMathTaglib);
export function buildLookup(dirname, requestedTranslator, onError) {
const translator = tryLoadTranslator(requestedTranslator);
diff --git a/packages/compiler/src/taglib/marko-html.json b/packages/compiler/src/taglib/marko-html.json
index 9c9d6424a..399ad7b1b 100644
--- a/packages/compiler/src/taglib/marko-html.json
+++ b/packages/compiler/src/taglib/marko-html.json
@@ -873,7 +873,10 @@
},
"
": {
"html": true,
- "attribute-groups": ["html-attributes"]
+ "attribute-groups": ["html-attributes"],
+ "parse-options": {
+ "text": true
+ }
},
"": {
"html": true,
diff --git a/packages/runtime-class/src/translator/tag/index.js b/packages/runtime-class/src/translator/tag/index.js
index 46e873055..a282c2866 100644
--- a/packages/runtime-class/src/translator/tag/index.js
+++ b/packages/runtime-class/src/translator/tag/index.js
@@ -57,7 +57,29 @@ export default {
moveIgnoredAttrTags(path);
}
- if (isDynamicTag(path) || !(isMacroTag(path) || isNativeTag(path))) {
+ if (isNativeTag(path)) {
+ if (tagDef && tagDef.name === "body") {
+ path
+ .get("body")
+ .pushContainer("body", [
+ t.markoTag(
+ t.stringLiteral("init-components"),
+ [],
+ t.markoTagBody(),
+ ),
+ t.markoTag(
+ t.stringLiteral("await-reorderer"),
+ [],
+ t.markoTagBody(),
+ ),
+ t.markoTag(
+ t.stringLiteral("_preferred-script-location"),
+ [],
+ t.markoTagBody(),
+ ),
+ ]);
+ }
+ } else if (!isMacroTag(path)) {
analyzeAttributeTags(path);
}
diff --git a/packages/runtime-class/src/translator/taglib/core/index.js b/packages/runtime-class/src/translator/taglib/core/index.js
index cd095a4ee..b3abf8ac7 100644
--- a/packages/runtime-class/src/translator/taglib/core/index.js
+++ b/packages/runtime-class/src/translator/taglib/core/index.js
@@ -3,6 +3,7 @@ import * as translateElseIf from "./conditional/translate-else-if";
import * as translateIf from "./conditional/translate-if";
import * as parseMacro from "./macro/parse";
import * as translateMacro from "./macro/translate";
+import migrate from "./migrate";
import * as parseClass from "./parse-class";
import * as parseExport from "./parse-export";
import * as parseImport from "./parse-import";
@@ -18,7 +19,8 @@ import * as translateServerOnly from "./translate-server-only";
import * as translateWhile from "./translate-while";
export default {
- "taglib-id": "marko-default-core",
+ taglibId: "marko-core",
+ migrate,
"": {
"node-factory": parseImport,
"parse-options": {
@@ -285,9 +287,6 @@ export default {
"code-generator": translateServerOnly,
renderer: "marko/src/core-tags/components/preferred-script-location-tag.js",
},
- "": {
- transformer: transformBody,
- },
"": {
renderer: "marko/src/core-tags/core/await/renderer.js",
types: "marko/src/core-tags/core/await/index.d.marko",
diff --git a/packages/runtime-class/src/translator/taglib/migrate/all-templates.js b/packages/runtime-class/src/translator/taglib/core/migrate.js
similarity index 100%
rename from packages/runtime-class/src/translator/taglib/migrate/all-templates.js
rename to packages/runtime-class/src/translator/taglib/core/migrate.js
diff --git a/packages/runtime-class/src/translator/taglib/core/parse-static.js b/packages/runtime-class/src/translator/taglib/core/parse-static.js
index f826bc8fc..0946427fc 100644
--- a/packages/runtime-class/src/translator/taglib/core/parse-static.js
+++ b/packages/runtime-class/src/translator/taglib/core/parse-static.js
@@ -14,5 +14,5 @@ export default function (path) {
body = body[0].body;
}
- path.replaceWith(t.MarkoScriptlet(body, true));
+ path.replaceWith(t.markoScriptlet(body, true));
}
diff --git a/packages/runtime-class/src/translator/taglib/index.js b/packages/runtime-class/src/translator/taglib/index.js
index 6d553a04c..e5c4cacd1 100644
--- a/packages/runtime-class/src/translator/taglib/index.js
+++ b/packages/runtime-class/src/translator/taglib/index.js
@@ -1,7 +1,6 @@
import coreTaglib from "./core";
-import migrateTaglib from "./migrate";
export const optionalTaglibs = ["marko-widgets", "@marko/compat-v4"];
export default [
- ["marko/core", coreTaglib],
- ["marko/migrate", migrateTaglib],
+ ["marko-html-title", { "": { parseOptions: { text: false } } }], // In Marko 5 the title tag parses as html even though only text is really allowed.
+ [coreTaglib.taglibId, coreTaglib],
];
diff --git a/packages/runtime-class/src/translator/taglib/migrate/index.js b/packages/runtime-class/src/translator/taglib/migrate/index.js
deleted file mode 100644
index a0e30f289..000000000
--- a/packages/runtime-class/src/translator/taglib/migrate/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as migrateAllTemplates from "./all-templates";
-export default {
- "taglib-id": "marko-default-migrate",
- migrator: migrateAllTemplates,
-};
diff --git a/packages/runtime-class/test/translator/fixtures/doctype/snapshots/vdomProduction-expected.js b/packages/runtime-class/test/translator/fixtures/doctype/snapshots/vdomProduction-expected.js
index 96d9a3f65..ad3f8a78a 100644
--- a/packages/runtime-class/test/translator/fixtures/doctype/snapshots/vdomProduction-expected.js
+++ b/packages/runtime-class/test/translator/fixtures/doctype/snapshots/vdomProduction-expected.js
@@ -3,18 +3,13 @@ const _marko_componentType = "M__dLOJ",
_marko_template = _t(_marko_componentType);
export default _marko_template;
import _marko_constElement from "marko/dist/runtime/vdom/helpers/const-element.js";
-const _marko_node = _marko_constElement("head", null, 1).e("title", null, 1).t("Title of the document");
+const _marko_node = _marko_constElement("html", null, 2).e("head", null, 1).e("title", null, 1).t("Title of the document").e("body", null, 1).t("The content of the document......");
import _marko_renderer from "marko/dist/runtime/components/renderer.js";
import { r as _marko_registerComponent } from "marko/dist/runtime/components/registry.js";
_marko_registerComponent(_marko_componentType, () => _marko_template);
const _marko_component = {};
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state, $global) {
- out.be("html", null, "0", _component, null, 0);
out.n(_marko_node, _component);
- out.be("body", null, "3", _component, null, 0);
- out.t("The content of the document......", _component);
- out.ee();
- out.ee();
}, {
t: _marko_componentType,
i: true
diff --git a/packages/runtime-tags/src/translator/core/index.ts b/packages/runtime-tags/src/translator/core/index.ts
index 6e83f4ef8..8ce88937f 100644
--- a/packages/runtime-tags/src/translator/core/index.ts
+++ b/packages/runtime-tags/src/translator/core/index.ts
@@ -22,7 +22,6 @@ import ScriptTag from "./script";
import ServerTag from "./server";
import StaticTag from "./static";
import StyleTag from "./style";
-import TitleTag from "./title";
import TryTag from "./try";
export default {
@@ -52,6 +51,5 @@ export default {
"": ServerTag,
"": StaticTag,
"