Skip to content

Commit

Permalink
Copy code-mirror-lang-js to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Nov 4, 2024
1 parent 19a3d7a commit c4d00cd
Show file tree
Hide file tree
Showing 32 changed files with 1,151 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist/
declarations/
node_modules/
tmp/
vendor/
public/
coverage/
*.ember-try
18 changes: 18 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

const { configs } = require('@nullvoxpopuli/eslint-configs');

const config = configs.crossPlatform();

module.exports = {
...config,
overrides: [
...config.overrides,
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
};
4 changes: 4 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
/src/parser.*
/dist
.cache
17 changes: 17 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.yml
*.yaml
*.md
*.json
renovate.json5
docs/

# errors at the moment on gts files in here
app/templates/

node_modules/
dist/
declarations/
public/
vendor/
coverage/
.lint-todo/
37 changes: 37 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

module.exports = {
printWidth: 100,
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
// Lol, JavaScript
files: ['*.js', '*.ts', '*.cjs', '.mjs', '.cts', '.mts', '.cts'],
options: {
singleQuote: true,
trailingComma: 'es5',
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
},
},
{
files: ['*.hbs'],
options: {
singleQuote: false,
},
},
{
files: ['*.gjs', '*.gts'],
options: {
parser: 'ember-template-tag',
singleQuote: true,
templateSingleQuote: false,
trailingComma: 'es5',
},
},
],
};
45 changes: 45 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# codemirror-lang-glimmer-js

## 0.0.0

### Patch Changes

- Updated dependencies []:
- [email protected]

## 0.0.0-beta.4

### Patch Changes

- 77ad072: Add and consume glimdown package, split gjs into gjs and gts
- 0071216: Dependency updates
- Updated dependencies [77ad072]
- Updated dependencies [0071216]
- [email protected]

## 0.0.0-beta.3

### Patch Changes

- 20dab8a: Initial development pre-release
- Updated dependencies [20dab8a]
- [email protected]

## 0.0.0-beta.2

### Patch Changes

- 40fd2df: Shipped built assets in the npm package
- Updated dependencies [40fd2df]
- [email protected]

## 0.0.0-beta.1

### Minor Changes

- e02e2b0: Initial release

### Patch Changes

- Updated dependencies [e02e2b0]
- [email protected]
20 changes: 20 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CodeMirror Glimmer

This is a CodeMirror 6 plugin that adds support for Glimmer (gjs and gts).

### Usage

```typescript
import { EditorState } from '@codemirror/state';
import { EditorView } from '@codemirror/view';
import { glimmer } from 'tbd';
import { basicSetup } from 'codemirror';

new EditorView({
state: EditorState.create({
doc: `<script>let a = "hello world";</script> <div>{a}</div>`,
extensions: [basicSetup, glimmer()],
}),
parent: document.querySelector('#editor'),
});
```
8 changes: 8 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist/
declarations/
node_modules/
tmp/
vendor/
public/
coverage/
*.ember-try
5 changes: 5 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

const { configs } = require('@nullvoxpopuli/eslint-configs');

module.exports = configs.crossPlatform();
17 changes: 17 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.yml
*.yaml
*.md
*.json
renovate.json5
docs/

# errors at the moment on gts files in here
app/templates/

node_modules/
dist/
declarations/
public/
vendor/
coverage/
.lint-todo/
37 changes: 37 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

module.exports = {
printWidth: 100,
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
// Lol, JavaScript
files: ['*.js', '*.ts', '*.cjs', '.mjs', '.cts', '.mts', '.cts'],
options: {
singleQuote: true,
trailingComma: 'es5',
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
},
},
{
files: ['*.hbs'],
options: {
singleQuote: false,
},
},
{
files: ['*.gjs', '*.gts'],
options: {
parser: 'ember-template-tag',
singleQuote: true,
templateSingleQuote: false,
trailingComma: 'es5',
},
},
],
};
3 changes: 3 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @glimdown/glimmer-js-dev-preview

## 0.0.1
42 changes: 42 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>

<style>
body {
margin: 0;
padding: 0;
background-color: #282c34;
}

.layout {
height: 100vh;
width: 100%;
display: grid;
grid-template-columns: 1fr 1fr;
overflow: hidden;
}
#editor {
height: 100vh;
overflow: scroll;
border-right: solid 0.125rem #111;
}

#editor-ast {
height: 100vh;
overflow: scroll;
}
</style>
</head>
<body class="replit-ui-theme-root dark">
<div class="layout">
<div id="editor"></div>
<div id="editor-ast"></div>
</div>

<script type="module" src="./preview.ts"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions packages/syntax/glimmer-ts/codemirror/dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@glimdown/glimmer-js-dev-preview",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite .",
"lint": "pnpm -w exec lint",
"lint:fix": "pnpm -w exec lint fix",
"lint:js": "pnpm -w exec lint js",
"lint:js:fix": "pnpm -w exec lint js:fix",
"lint:prettier:fix": "pnpm -w exec lint prettier:fix",
"lint:prettier": "pnpm -w exec lint prettier"
},
"devDependencies": {
"@babel/core": "^7.25.7",
"@babel/eslint-parser": "^7.25.7",
"@codemirror/language": "^6.10.3",
"@codemirror/state": "^6.4.0",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.34.1",
"@glimdown/codemirror-dev-preview": "workspace:*",
"@nullvoxpopuli/eslint-configs": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "^8.55.0",
"prettier": "^3.3.3",
"typescript": "^5.4.5",
"vite": "^5.4.8"
},
"volta": {
"extends": "../../../../../package.json"
},
"repository": {
"type": "git",
"url": "https://github.com/NullVoxPopuli/limber.git",
"directory": "packages/syntax/glimmer-js/codemirror/dev"
},
"license": "MIT",
"author": "NullVoxPopuli"
}
Loading

0 comments on commit c4d00cd

Please sign in to comment.