Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially import melody project into core #33

Merged
merged 28 commits into from
Jul 18, 2024
Merged

Conversation

zackad
Copy link
Owner

@zackad zackad commented Jul 18, 2024

Related: GH-26, GH-32

This patch contains trivago/melody that has been stripped down using git-filter-repo. This is an attempt to retain git history before applying GH-32.

James Bell and others added 27 commits October 19, 2017 12:58
- Setup travis
- Fix broken dependencies
- Change prettier to use es5 as trailing comma strategy
- Change min node version to 6
Looks very good. Thank you for taking care of this one!
* Add tests for the 'not in' operator

* Don't match operators that are followed by an alphanumeric character

This prevents issues like `not invalid` matching the `not in` operator. We only
check for operators that contain a whitespace as those that don't are already
matched as a symbol.
- Added `filters.template` file to test all Twig filters and updated snapshot
Add implementation for filter 'trim' to be compatible with Twig
* Add initial draft of async mounting

* Fixed handling the default import

* Update test

* Update changelog

* Add more tests

* Add test for async component which is unmounted before its loaded
* Throws better error for NBSP tokens [#85]

Co-Authored-By: byara <6979966+byara@users.noreply.github.com>
* melody-types: Add TwigComment Node type
melody-parser: Preserve comments in AST

* Add parser option to ignore Twig comments or not
Add CHANGELOG entry
* melody-types: Add TwigComment Node type
melody-parser: Preserve comments in AST

* Add parser option to ignore Twig comments or not
Add CHANGELOG entry

* melody-types: Add node type "HtmlComment"
melody-parser: Optionally preserve HTML comments
* melody-types: Add TwigComment Node type
melody-parser: Preserve comments in AST

* Add parser option to ignore Twig comments or not
Add CHANGELOG entry

* melody-types: Add node type "HtmlComment"
melody-parser: Optionally preserve HTML comments

* Add option "decodeEntities"

* Add some documentation on melody-parser
Avoid whitespace trimming (optimization) in TokenStream if "ignoreWhitespace" option is false
* Avoid whitespace trimming (optimization) in tokenizer if "ignoreWhitespace" option is false

* Update packages/melody-parser/src/TokenStream.js

Small semantic fix

Co-Authored-By: Patrick Gotthardt <pago@users.noreply.github.com>

* Introduce applyWhitespaceTrimming option for TokenStream
Improve option handling in Parser and TokenStream
Update tests and snapshots

* Update CHANGELOG

* Add new flags to expression nodes:
exprStartBefore
exprEndAfter
trimLeft
trimRight

* Avoid re-assignment to function parameter

* Remove exprStartBefore and exprEndAfter flags
They are probably not needed
* Mark BinaryConcatExpressions generated by Melody with "wasImplicitConcatenation" (true/false)
* Update CHANGELOG
* Add trimLeft and trimRight information to Twig tags
Add test / update snapshots
Add "applyExtension" method to Lexer and Parser

* Add whitespace trimming information to autoescape block
Update tests

* Improve parse() function interface
Simplify AutoescapeSpec.js

* Add whitespace trimming information to BlockStatement

* Add whitespace trimming information to embed

* Add whitespace trimming information to filter block

* Add whitespace trimming information to for loop

* Add whitespace trimming information to if statement

* Add whitespace trimming information to macro

* Add whitespace information to mount tag

* Add whitespace trimming information to set statement

* Add whitespace trimming information to spaceless tag

* Unify trimLeft... and trimRight... attribute names

* Transform autoescape test to use snapshots like the other tests
* Add parsing of declarations like <!DOCTYPE html>
* Update CHANGELOG
* Improve location information on AST nodes
* Add `getNodeSource()` method on the melody-parser package
* Update and add test cases
* Add missing trimLeft and trimRight properties on PrintExpressionStatement nodes
* Add test case covering the changes
* Update CHANGELOG
* Add failing test case
* Keep matchNumber() from ending a Number token with a dot
* Update CHANGELOG
* Fix bug where all backslashes in strings are removed
* Introduce "preserveSourceLiterally" option
* Update README and CHANGELOG
* Add Lexer test case with escaped newline
* Introduce
- GenericTwigTag
- GenericTagParser
- Option allowUnknownTags

* Add test cases (from Craft CMS)
Enable "unexpected" tokens in generic tag

* Add multi-tag parsing for unknown tags

* Fix location information for generic twig tags

* Set allowUnknownTags option to true when custom multiTags are provided

* Update README to document the use of `allowUnknownTags` and `multiTags`
@zackad
Copy link
Owner Author

zackad commented Jul 18, 2024

Seems like #32 copying content from packages/melody-*/src into src/melody/melody-*/ directly. We need to skip src directory from filtered repo.

@zackad
Copy link
Owner Author

zackad commented Jul 18, 2024

need to re-import with fixed path to adhere #32 file structure.

Script to filter melody project

#!/usr/bin/env sh

# `melody-repo` is the original melody repository
# `target-repo` is git repo where the filtered will be placed
git filter-repo --source melody-repo --target target-repo \
	--path packages/melody-code-frame/src \
	--path packages/melody-extension-core/src \
	--path packages/melody-parser/src \
	--path packages/melody-types/src \
	--path packages/melody-traverse/src \
	--path-rename packages/melody-code-frame/src:src/melody/melody-code-frame \
	--path-rename packages/melody-extension-core/src:src/melody/melody-extension-core \
	--path-rename packages/melody-parser/src:src/melody/melody-parser \
	--path-rename packages/melody-traverse/src:src/melody/melody-traverse \
	--path-rename packages/melody-types/src:src/melody/melody-types

Related: GH-26, GH-32

This project has external dependencies that no longer updated. Instead
of forking and probably re-releasing it as separate packages it might be
easier if we integrated it directly. This way, we don't have to manage
separate project.
@zackad zackad force-pushed the pull-melody-packages branch from 67d842a to 0d9e2aa Compare July 18, 2024 03:34
@rellafella
Copy link
Collaborator

obviously going to fail the tests due to all the Typescript within these files, but this looks like a successful merge!

@zackad zackad merged commit 4ee9e05 into master Jul 18, 2024
0 of 2 checks passed
@zackad zackad deleted the pull-melody-packages branch July 18, 2024 04:05
@zackad
Copy link
Owner Author

zackad commented Jul 18, 2024

Your PR on #32 has fixed this problem. Need to rebase with --strategy-option=theirs flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants