rome / tools Goto Github PK
View Code? Open in Web Editor NEWUnified developer tools for JavaScript, TypeScript, and the web
Home Page: https://docs.rome.tools/
License: MIT License
Unified developer tools for JavaScript, TypeScript, and the web
Home Page: https://docs.rome.tools/
License: MIT License
Hi,
./scripts/build-release dist
.package.json
{
"name": "rome-hello-world",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"compile": "rome compile src/index.js",
"lint": "rome lint src/index.js"
},
"author": "i.mirdzhamolov",
"license": "ISC",
"devDependencies": {
"rome": "file:../rome/dist"
}
}
When try to run npm run compile
or npm run lint
I get error
~/projects/rome-hello-world $ npm run lint
> [email protected] lint /Users/i.mirdzhamolov/projects/rome-hello-world
> rome lint src/index.js
/Users/i.mirdzhamolov/projects/rome-hello-world/node_modules/.bin/rome: line 1: syntax error near unexpected token `('
/Users/i.mirdzhamolov/projects/rome-hello-world/node_modules/.bin/rome: line 1: `(function(global) {'
What I do wrong? ๐ค
I think it makes sense to have an issue for documentation-related tasks since the website is up now. Here's a couple things I was thinking would be good to add as a start:
rome init
instead of echo
- possibly a two tracks, one for new projects one for existingpackages/@romejs/core/master/commands
)After writing the install and getting started, I'm thinking it makes sense to break the remaining up into a section of "Everyday Rome" which covers the most commonly used commands in depth with examples, a section of "Rome and Frameworks" which covers any framework-specific steps, and a section of "Rome Commands" which covers every option on every command, not necessarily with a ton of examples.
I'll try and work through some of these this week, but any help would be appreciated - if anyone has ideas on other things that would be valuable to add, that would be great!
Followed is a list of ESLint rules that we should implement.
return
statements in getters (getter-return) #129Please comment if you want to work on one of these and I'll mark you to avoid duplicating work. Mentions next to rules indicate that someone else is working on it. If a PR isn't opened within a few days then it will be up for grabs.
A checkmark indicates an open PR.
Playing with dev-rome
a bit the documentation seems to only go one level deep; listing the commands that are available on ./scripts/dev-rome --help
. Specific help for subcommands was not present and so I ran into ๐๐ป quite quickly.
Couldn't find a rome.json or rome.rjson or .rome.json or .rome.rjson for
/my/cool/project/path
The following would be really helpful (to me, a totally random new user ๐ ):
./scripts/dev-rome config --help
)Seems relevant to #7
Since I implemented TypeScript support there has been new syntax added such as assert
that I've yet to add.
All the regexes I see in the code use capturing groups, but don't make use of the captured group. Not sure what percentage of performance is related to the regexes, but just wondering if you have tested using non-capturing groups to see if it makes a significant difference? Maybe you have already figured this out and are going with the easier to read option. Babel does the same thing.
๐
Flow supports this on import specifiers, not sure if TypeScript does so that may be the one exception to this.
Rome was the capital of the Roman Empire, a society run through ************, slavery and violence. Your etymological trivia refers to proverbs that seem innocent but refers to slavery and assimilation.
Sure you could argue about the technicalities of what you're actually referring to, but that's irrelevant. No matter your intensions, the profile of this project is of white ruling and conquest. You can pick a much better one, one that isn't offending or reeks of white peoples' historical ignorance, one that conveys union, cooperation and solidarity rather than wartime colonialism and oppression.
Rename this to something that refers to American slavery and ask for feedback.
Outrage.
There's a plan to make Rome a package manager too? This way the only external dependency would be the Node itself.
Description:
Consider the following file, which with various extensions doesn't parse.
/** @jsx mdx */
import {mdx} from '@mdx-js/preact';
export default function MDXContent() {
return <h1>hi</h1>>;
}
When using .js
:
> ./scripts/dev-rome parse test-file.js
test-file.js:2 parse/js โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ import and export can only appear in a module
1 โ /** @jsx mdx */
> 2 โ import {mdx} from '@mdx-js/preact';
โ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 โ
4 โ export default function MDXContent() {
โน Change the extension to .mjs to turn this file into a module
โน Add "type": "module" to your package.json
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When using .mjs
> ./scripts/dev-rome parse test-file.mjs
test-file.mjs:5:9 parse/js โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ JSX syntax isn't enabled
4 โ export default function MDXContent() {
> 5 โ return <h1>hi</h1>>;
โ ^
6 โ }
โน Are you using TypeScript? Change the file extension to .tsx
โน Are you using Flow? Add a @flow comment annotation to the top of the file
โน Not using either? Change the file extension to .jsx
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Found 1 problem
when using .jsx
./scripts/dev-rome parse test-file.jsx
test-file.jsx:2 parse/js โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ import and export can only appear in a module
1 โ /** @jsx mdx */
> 2 โ import {mdx} from '@mdx-js/preact';
โ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 โ
4 โ export default function MDXContent() {
โน Change the extension to .mjs to turn this file into a module
โน Add "type": "module" to your package.json
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Found 1 problem
test-file
with the appropriate extension from above (.js
, .mjs
, or .jsx
)../scripts/dev-rome parse test-file.jsx
I expected it to be able to parse ES Modules without .mjs
since this is supported by browsers. I didn't expect the .jsx
extension to be relevant, although I can understand that. I expected that a file with ES Modules and JSX syntax would be parsed regardless of file extension.
Description:
Issues link in contributing page is broke
GitHub issues
Issues Page is open
Right now ExportNamedDeclaration
is overloaded.
The current logo is OK but it would be nice to have something a lot simpler. It was created with an SVG I purchased which was modified with illustrator and the lines smoothed out and color with shading added.
Description:
OSX 10.15.1
Node v12.14.1
Tried to follow the steps in CONTRIBUTING.md but keep running into a too many open files
error.
I see the Adding project /...
line for about a second and then the error pops up.
โฏ git clone [email protected]:facebookexperimental/rome.git
Cloning into 'rome'...
...
Updating files: 100% (8958/8958), done.
โฏ cd rome
โฏ scripts/dev-rome --help
โ Disk caching has been disabled due to the ROME_CACHE=0 environment variable โ
โ Fatal error occurred: Error: EMFILE: too many open files, watch
at
FSEvent.onchange (internal/fs/watchers.js:123:27)
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '/tmp/rome-dev/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
โฏ ROME_CACHE=1 scripts/dev-rome --help
โ Disk caching has been disabled due to the ROME_CACHE=0 environment variable โ
โ Fatal error occurred: Error: EMFILE: too many open files, watch
at
FSEvent.onchange (internal/fs/watchers.js:123:27)
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '/tmp/rome-dev/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
โฏ ./scripts/build-release dist
โ Disk caching has been disabled due to the ROME_CACHE=0 environment variable โ
โ Fatal error occurred: Error: EMFILE: too many open files, watch
at
FSEvent.onchange (internal/fs/watchers.js:123:27)
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '/tmp/rome-dev/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Expected to see rome help
When the dependency uses require function, I got error
Uncaught ReferenceError: require is not defined
Generated code
const ___R$$priv$project$...$supports$color$index_js$os = require('os');
The bundle was created successfully but got error at runtime.
Error happen when depend project on axios module.
NodeJS API should be exclude from client-side bundle.
This issue documents possible Rome integrations into existing tools.
This will be limited by the public API discussed in #10, notably async only methods that may restrict integration in some tooling.
js-parser
is a fork of babel-parser
. The code has diverged way too far to allow any sort of commit merging but the test fixtures are still valuable. packages/@romejs/js-parser/__rtests__/__rfixtures__/
should be updated with those from babel-parser/test/fixtures
and the numerous bugs fixed that they uncover.
Hi :)
I was reading the Getting Started section in the contributing documentation.
In the below line mentioned about node_modules folder.
No dependency installation step is required as we check in our node_modules folder that contains only a copy of TypeScript and some definitions.
I clicked it but as you can see there is no .github folder. I think this is the new location of the node_modules folder.
Currently getting this Node deprecation message:
(node:2968) [DEP0130] DeprecationWarning: Module.createRequireFromPath() is deprecated. Use Module.createRequire() instead.
Hello! I have created a new project and added rome as a dependency. Here's my package.json
:
{
"name": "myproject",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"rome": "node ./node_modules/rome/bin/rome"
},
"author": "rzig",
"license": "ISC",
"devDependencies": {
"rome": "file:../rome/dist"
}
}
The file in src/index.js
is just one line, console.log("Hi");
.
I am able to successfully run npm run rome compile src/index.js
, but running npm run rome config enable lint
fails with the following:
โ Setting lint to true in the project config rome.json
โ Error occured while testing new project config. Your changes have not been saved.
rome.json:2:10 json โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Expected object at lint
1 โ {
> 2 โ "lint": true
โ ^^^^
3 โ }
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When I manually update rome.json
and run npm run rome lint src/index.js
, I get
rome.json:2:12 json โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Expected object at lint
1 โ {
> 2 โ "lint": true
โ ^^^^
3 โ }
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
I'm guessing the reason that the second step of rome config enable lint
fails is because rome is setting lint
to true
when it should actually be an object?
Prior art in this space:
The rome
package will likely be the only package published for users. This will contain the CLI and a very thin API that heavily limits the public API exposed. There's no intention to publish any other packages as this would heavily restrict the changes we can make.
The package @romejs/project
is responsible for loading, validating, and normalizing project configs. Rome project config exist as rome.json
or rome.rjson
files. It can also take the form of a rome
property in package.json
.
I've yet to start building any sort of website. I'd love for someone else to start building one as it will definitely be needed for our first release.
One of the project goals is to minimize the API, but right in the getting started guide, we see the project configuration "can take three possible forms": rome.json, rome.rjson or "rome" entry in package.json.
Already too many options. Is there a case where a project won't have a package.json!?
IMHO we should stick to "rome" entry in package.json.
This can currently trigger false negatives/positives.
We have a package called string-markup
that we process all strings through when we log to the console. This is also used inside of diagnostics strings. It's a HTML-like syntax that removes the need for hardcoding ANSI formatting, and would allow easy formatting in more rich environments like an IDE.
It looks like this:
Successfully formatted <number>5000</number> files
Compiled <emphasis><filelink filename="foo.ts" /></emphasis>
Some possible tags are:
inverse
dim
emphasis
italic
underline
strike
black
brightBlack
red
brightRed
green
brightGreen
yellow
brightYellow
blue
brightBlue
magenta
brightMagenta
cyan
brightCyan
white
brightWhite
bgBlack
bgBrightBlack
bgRed
bgBrightRed
bgGreen
bgBrightGreen
bgYellow
bgBrightYellow
bgBlue
bgBrightBlue
bgMagenta
bgBrightMagenta
bgCyan
bgBrightCyan
bgWhite
bgBrightWhite
These map exactly to their typical ANSI formatting equivalent. In the future we might want to remove the color names in favor of aliases like primary
, secondary
etc and leaving it up to the formatter to decide colors.
This becomes more powerful with abstractions like these that could be make richer in interactive environments:
number
Humanizes numbers
Example
<number>5000</number>
-> 5_000
hyperlink
<hyperlink target="https://google.com">Google</hyperlink>
filelink
This is used to link to specific source file with an optional column
and line
.
In a terminal that supports hyperlinks it will be a clickable link that opens the file in the default editor.
When inner text is omitted a humanize version of target
is used.
Example Error occured at <filelink target="foo.ts" column="5" line="10" />
-> Error occured at foo.ts:5:10
duration
Used for formating millisecond durations.
Example : <duration>5000</duration>
-> 5s
Example: <duration approx>5000</duration>
-> ~5s
filesize
Used for humanizing file sizes in bytes.
Example <filesize>5000</filesize>
-> 5KB
If you have an existing tag you can avoid wrapping them in an emphasis
or dim
tag by just using it as an attribute.
Example Instead of <emphasis><filelink target="foo.ts" /></emphasis>
you can use <filelink emphasis target="foo.ts" />
There is two non-inclusive words on master branch: 'whitelist' and 'blacklist'.
I think they are not inclusive and should be replaced by 'allow-list' and 'disallow-list' or some equivalent.
https://github.com/facebookexperimental/rome/blob/master/packages/%40romejs/js-compiler/transforms/compile/validation/optimizeImports.ts#L29
https://github.com/facebookexperimental/rome/blob/master/packages/%40romejs/js-parser/xhtmlEntities.ts#L273
Thanks
The Rome AST is derived from estree but with some pretty significant changes. Contained here are notes that may be useful when working with it.
Redundant AST nodes have been eliminated. Some of these exist in estree to provide additional location information eg. ClassBody
but it has been eliminated in favor of putting the body
array on the parent.
The entire AST is fully strongly typed and type definitions can be found in packages/@romejs/js-ast/
. This makes it relatively easy to follow and will exist as canonical documentation.
Flow and TypeScript nodes are prefixed with namespaces.
Effort has been made to reduce ambiguity in the AST, ie. Identifier
has been split into AssignmentIdentifier
, BindingIdentifier
and ReferenceIdentifier
.
If multiple AST node types share properties then it's been abstracted into another node. For example, ClassExpression
and ClassDeclaration
both have a ClassHead
property. This makes it easy to convert between the two by just retaining the head
.
This is more notable with PatternMeta
which is set on pattern node types.
Object keys have a dedicated node in the form of ComputedPropertyKey
and StaticPropertyKey
. These are shared amongst ObjectProperty
, ClassMethod
etc. This makes it very easy to share logic.
Similarly, MemberExpression
has a ComputedMemberProperty
and StaticMemberProperty
property.
Would love to help out with some documentation on building from source - if you can point me in the right direction I'm happy to make a PR ๐
Diagnostics are an extremely powerful feature of Rome that allow the generic construction and presentation of errors in source code.
packages/@romejs/diagnostics/types.ts
.PartialDiagnostic
type, which has a lot of optional properties and allows building up diagnostics in a more raw manner. The Diagnostic
type has required properties that during normalization from PartialDiagnostic
are inferred if necessary. This format is what is exposed to consumers and formatting logic.@romejs/diagnostics
contains the type definitions, normalization logic, and other utilities.@romejs/cli-diagnostics
contains the terminal formatting logic.We have almost 100 TODO comments throughout the codebase. Go through these and work out what's still relevant and create issues for the rest. https://github.com/facebookexperimental/rome/search?q=TODO&unscoped_q=TODO
As the project matures we'll want to have a more established governance structure. This wont be an area of focus until a published release.
Description:
I get the following error when trying to bundle a hapijs
server.
This scope does not allow
variables. This is probably because
variables were injected into a scope that did not contain
var in the original source.program
Error occurred while requesting compile for project-quick-server/@hapi/hapi/lib/config.js
Congrats on Rome! A lot of people are excited about this project and some people are itching to get involved. There are already a lot of issues in the issue tracker and there are clearly laid out philosophies, etc. Seems like fertile ground for folks to contribute.
It would be great if layered on top of the good work here if there was some signal about areas you're specifically looking for active help on from people who are eager to contribute but haven't yet consumed the roadmap. Perhaps you have it already and I haven't looked closely enough.
What is best way to get outside contributors involved? And what specifically are y'all looking for contributions to currently that aren't already assigned to the existing team?
The Rome parser is located at packages/@romejs/js-parser/
. It was a fork of @babel/js-parser
that has diverged so much it's almost indistinguishable.
Followed are some notes that may be useful.
Parser
classes.Please describe the actual usage of the package
Its amazing how there can be such a long readme file and it still does not communicate what this actually does...
โ https://news.ycombinator.com/item?id=22430940
Description:
I'm trying to bundle a node hapijs app and running into an issue where versions which are npm aliases are failing.
Try bundling a basic hapijs
server. It's getting stuck in the package.js
file of one the dependencies on "@hapi/joi-legacy-test": "npm:@hapi/[email protected]"
I'd be glad to create a fix if you point me in the right direction.
This issue is to track the milestone Published Release.
Rome is still in development and once we are confident we have something usable and stablefor a wider audience we'll publish to npm.
Rome contains a custom JSON parser at packages/@romejs/codec-json
. The primary motivation for building this was JSON.parse
does not emit detailed information for syntax errors. So I decided to build a vanilla JSON parser with detailed errors that emits Rome diagnostics (#3).
Once I had this built, it was quite easy to add JSON extensions. So I did. They are only enabled when a filename is passed in that ends in .rjson
, so the parser can parse with and without.
These extensions do not add additional data types and are purely syntactic. When using extensions with a regular JSON file, the error messages will specifically mention it.
The features of RJSON are as followed.
If a property key is a valid identifier then the quotes can be omitted, just like in regular JavaScript.
{
unquotedKey: true
}
Commas are not required to separate elements of an array or object properties.
Example
[
1
2
3
]
{
a: 1
b: 2
c: 3
}
With the addition of numeric separators in JavaScript, support has been added in RJSON.
Example
5_000
Standard JS comments are supported. Both line and block comments.
The comment support also allows the manipulation of an RJSON file, while retaining comments.
Example
{
// Line comment
/* Block comment */
foo: "bar"
}
Curly braces at the top level aren't required if it's just a list of properties.
Empty input is treated as an empty implicit object.
Example
foo: "bar"
"bar": "foo"
Currently all of the scripts are written in bash which is possible to get working on WSL, but it may be a bridge too far for a lot of people. Maybe these scripts could be ported to Node?
as node_modules is from history I don't think creating PR is easy . However I think we should add node_modules to gitignore ?
I used the following command to remove entire node modules from git history
find . -name node_modules -print0 | xargs -0 git rm -rf --ignore-unmatch
I did made a fork which address this issue.
https://github.com/shirshak55/rome/
I think pushing node_module is not intentional right?
The current area of focus for Rome is linting. This is the path of least resistance for finishing a part of Rome that can be used most easily.
With diagnostics #3 the lints that Rome can produce will be more detailed than any other existing JS linter. The most difficult part of this will be editor integration and writing a set of lint rules.
One large question is how we handle configuration. Are we going to take an opinionated stance and have some lints non-configurable? Will we have plugins?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.