@marko/translator-default 5.31.16 → 5.32.0

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.
@@ -10,6 +10,7 @@
10
10
  var _compiler = require("@marko/compiler");
11
11
  var _util = require("./util");
12
12
 
13
+ const attributeTagsForTag = new WeakMap();
13
14
  const contentTypeCache = new WeakMap();
14
15
  const ContentType = {
15
16
  attribute: 0,
@@ -51,7 +52,39 @@ function analyzeAttributeTags(rootTag) {
51
52
 
52
53
  const parentTag = (0, _babelUtils.findParentTag)(child);
53
54
  const parentTagExtra = parentTag.node.extra ||= {};
54
- parentTagExtra.hasAttributeTags = true;
55
+ const parentSeenAttributeTagProperties =
56
+ attributeTagsForTag.get(parentTag);
57
+ let hasAttributeTags = false;
58
+
59
+ if (!parentSeenAttributeTagProperties) {
60
+ parentTagExtra.hasAttributeTags = true;
61
+ attributeTagsForTag.set(parentTag, new Set([targetProperty]));
62
+ } else if (parentSeenAttributeTagProperties.has(targetProperty)) {
63
+ hasAttributeTags = true;
64
+ } else {
65
+ parentSeenAttributeTagProperties.add(targetProperty);
66
+ }
67
+
68
+ if (!hasAttributeTags) {
69
+ if (
70
+ parentTag.
71
+ get("attributes").
72
+ some(
73
+ (attr) =>
74
+ attr.isMarkoSpreadAttribute() ||
75
+ attr.node.name === targetProperty
76
+ ))
77
+ {
78
+ parentTag.pushContainer(
79
+ "attributes",
80
+ _compiler.types.markoAttribute(
81
+ targetProperty,
82
+ _compiler.types.unaryExpression("void", _compiler.types.numericLiteral(0))
83
+ )
84
+ );
85
+ }
86
+ }
87
+
55
88
  parentTags.push(child);
56
89
  visit.push(child);
57
90
  } else if ((0, _babelUtils.isTransparentTag)(child)) {
@@ -4,6 +4,7 @@
4
4
 
5
5
 
6
6
 
7
+
7
8
  var _compiler = require("@marko/compiler");
8
9
  var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location"));
9
10
  var _dynamicTag = _interopRequireDefault(require("./dynamic-tag"));
@@ -43,7 +44,20 @@ function _default(path, isNullable) {
43
44
  let binding = path.scope.getBinding(tagName);
44
45
  if (binding && !binding.identifier.loc) binding = null;
45
46
 
46
- if (relativePath) {
47
+ const childFile = (0, _babelUtils.loadFileForTag)(path);
48
+ const childProgram = childFile?.ast.program;
49
+
50
+ if (childProgram?.extra?.___featureType === "tags") {
51
+ (0, _babelUtils.importDefault)(
52
+ file,
53
+ `marko/src/runtime/helpers/tags-compat-${
54
+ markoOpts.output === "html" ? "html" : "dom"
55
+ }.js`,
56
+ "marko_tags_compat"
57
+ );
58
+ path.set("name", (0, _babelUtils.importDefault)(file, relativePath, path.node.name.value));
59
+ return (0, _dynamicTag.default)(path);
60
+ } else if (relativePath) {
47
61
  if (binding) {
48
62
 
49
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/translator-default",
3
- "version": "5.31.16",
3
+ "version": "5.32.0",
4
4
  "description": "Translates Marko templates to the default Marko runtime.",
5
5
  "keywords": [
6
6
  "babel",
@@ -10,11 +10,11 @@
10
10
  "parser",
11
11
  "plugin"
12
12
  ],
13
- "homepage": "https://github.com/marko-js/marko/blob/master/packages/translator-default/README.md",
13
+ "homepage": "https://github.com/marko-js/marko/blob/main/packages/translator-default/README.md",
14
14
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/marko-js/marko/tree/master/packages/translator-default"
17
+ "url": "https://github.com/marko-js/marko/tree/main/packages/translator-default"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Dylan Piercey <dpiercey@ebay.com>",
@@ -25,17 +25,17 @@
25
25
  "index.d.ts"
26
26
  ],
27
27
  "scripts": {
28
- "build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production"
28
+ "build": "babel ./src --out-dir ./dist --copy-files --config-file ../../babel.config.js --env-name=production"
29
29
  },
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.23.8",
32
- "@marko/babel-utils": "^6.3.5",
33
- "magic-string": "^0.30.5",
31
+ "@babel/runtime": "^7.23.9",
32
+ "@marko/babel-utils": "^6.4.0",
33
+ "magic-string": "^0.30.6",
34
34
  "self-closing-tags": "^1.0.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@marko/compiler": "^5.34.7",
38
- "marko": "^5.32.11"
37
+ "@marko/compiler": "^5.35.0",
38
+ "marko": "^5.33.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@marko/compiler": "^5.16.1",
@@ -44,6 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "main:dev": "src/index.js",
48
- "main:npm": "dist/index.js"
47
+ "main:override": "src/index.js"
49
48
  }