-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow duplicate macros with a warning instead of an error
- Loading branch information
1 parent
e491e45
commit 339c28d
Showing
23 changed files
with
140 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@marko/translator-default": patch | ||
"@marko/babel-utils": patch | ||
"@marko/compiler": patch | ||
"marko": patch | ||
"@marko/runtime-tags": patch | ||
"@marko/translator-interop-class-tags": patch | ||
"@marko/translator-tags": patch | ||
--- | ||
|
||
Allow diagnostic fixes in parse stage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/translator-default": patch | ||
--- | ||
|
||
Reduce duplicated macros from an error to a warning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/translator-default": patch | ||
--- | ||
|
||
Add auto fix for named inline component classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-default/test/fixtures/error-class-with-name/snapshots/generated-expected.diagnostics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
deprecation(1:7-1:11): Component class should not have a name. | ||
deprecation[fixable](1:7-1:11): Component class should not have a name. |
8 changes: 0 additions & 8 deletions
8
...s/translator-default/test/fixtures/error-macro-duplicate/snapshots/cjs-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...slator-default/test/fixtures/error-macro-duplicate/snapshots/generated-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
.../translator-default/test/fixtures/error-macro-duplicate/snapshots/html-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...r-default/test/fixtures/error-macro-duplicate/snapshots/htmlProduction-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...anslator-default/test/fixtures/error-macro-duplicate/snapshots/hydrate-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
.../translator-default/test/fixtures/error-macro-duplicate/snapshots/vdom-error-expected.txt
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...r-default/test/fixtures/error-macro-duplicate/snapshots/vdomProduction-error-expected.txt
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/translator-default/test/fixtures/warn-macro-duplicate/snapshots/cjs-expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _index = require("marko/src/runtime/html/index.js"); | ||
var _renderer = _interopRequireDefault(require("marko/src/runtime/components/renderer.js")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const _marko_componentType = "packages/translator-default/test/fixtures/warn-macro-duplicate/template.marko", | ||
_marko_template = (0, _index.t)(_marko_componentType); | ||
var _default = exports.default = _marko_template; | ||
const _marko_component = {}; | ||
_marko_template._ = (0, _renderer.default)(function (input, out, _componentDef, _component, state, $global) { | ||
function _thing(out, stuff) { | ||
out.w("<div>"); | ||
out.w("a"); | ||
out.w("</div>"); | ||
} | ||
}, { | ||
t: _marko_componentType, | ||
i: true, | ||
d: true | ||
}, _marko_component); |
1 change: 1 addition & 0 deletions
1
...r-default/test/fixtures/warn-macro-duplicate/snapshots/generated-expected.diagnostics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
warning[fixable](5:15-5:27): A macro with the name "thing" already exists. |
5 changes: 5 additions & 0 deletions
5
.../translator-default/test/fixtures/warn-macro-duplicate/snapshots/generated-expected.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<macro|stuff| name="thing"> | ||
<div> | ||
a | ||
</div> | ||
</macro> |
17 changes: 17 additions & 0 deletions
17
packages/translator-default/test/fixtures/warn-macro-duplicate/snapshots/html-expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { t as _t } from "marko/src/runtime/html/index.js"; | ||
const _marko_componentType = "packages/translator-default/test/fixtures/warn-macro-duplicate/template.marko", | ||
_marko_template = _t(_marko_componentType); | ||
export default _marko_template; | ||
import _marko_renderer from "marko/src/runtime/components/renderer.js"; | ||
const _marko_component = {}; | ||
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state, $global) { | ||
function _thing(out, stuff) { | ||
out.w("<div>"); | ||
out.w("a"); | ||
out.w("</div>"); | ||
} | ||
}, { | ||
t: _marko_componentType, | ||
i: true, | ||
d: true | ||
}, _marko_component); |
14 changes: 14 additions & 0 deletions
14
...ranslator-default/test/fixtures/warn-macro-duplicate/snapshots/htmlProduction-expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { t as _t } from "marko/dist/runtime/html/index.js"; | ||
const _marko_componentType = "IOFxoILb", | ||
_marko_template = _t(_marko_componentType); | ||
export default _marko_template; | ||
import _marko_renderer from "marko/dist/runtime/components/renderer.js"; | ||
const _marko_component = {}; | ||
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state, $global) { | ||
function _thing(out, stuff) { | ||
out.w("<div>a</div>"); | ||
} | ||
}, { | ||
t: _marko_componentType, | ||
i: true | ||
}, _marko_component); |
Empty file.
21 changes: 21 additions & 0 deletions
21
packages/translator-default/test/fixtures/warn-macro-duplicate/snapshots/vdom-expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { t as _t } from "marko/src/runtime/vdom/index.js"; | ||
const _marko_componentType = "packages/translator-default/test/fixtures/warn-macro-duplicate/template.marko", | ||
_marko_template = _t(_marko_componentType); | ||
export default _marko_template; | ||
import _marko_renderer from "marko/src/runtime/components/renderer.js"; | ||
import { r as _marko_registerComponent } from "marko/src/runtime/components/registry.js"; | ||
_marko_registerComponent(_marko_componentType, () => _marko_template); | ||
const _marko_component = {}; | ||
_marko_template._ = _marko_renderer(function (input, out, _componentDef, _component, state, $global) { | ||
function _thing(out, stuff) { | ||
out.be("div", null, "1", _component, null, 0); | ||
out.t("a", _component); | ||
out.ee(); | ||
} | ||
}, { | ||
t: _marko_componentType, | ||
i: true, | ||
d: true | ||
}, _marko_component); | ||
import _marko_defineComponent from "marko/src/runtime/components/defineComponent.js"; | ||
_marko_template.Component = _marko_defineComponent(_marko_component, _marko_template._); |
20 changes: 20 additions & 0 deletions
20
...ranslator-default/test/fixtures/warn-macro-duplicate/snapshots/vdomProduction-expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { t as _t } from "marko/dist/runtime/vdom/index.js"; | ||
const _marko_componentType = "IOFxoILb", | ||
_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("div", null, 1).t("a"); | ||
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) { | ||
function _thing(out, stuff) { | ||
out.n(_marko_node, _component); | ||
} | ||
}, { | ||
t: _marko_componentType, | ||
i: true | ||
}, _marko_component); | ||
import _marko_defineComponent from "marko/dist/runtime/components/defineComponent.js"; | ||
_marko_template.Component = _marko_defineComponent(_marko_component, _marko_template._); |
File renamed without changes.