deploy: v0.12 存档迁移+考古日志滚动条

This commit is contained in:
2026-06-24 03:04:38 +00:00
parent 4831505ef9
commit b4c6111516
58986 changed files with 7569452 additions and 31667 deletions
+34
View File
@@ -0,0 +1,34 @@
## 0.1.4 (2025-04-25)
### Bug fixes
Allow self-closing XML-style tags.
## 0.1.3 (2023-12-28)
### Bug fixes
Tag interpolations as isolating for the purpose of bidirectional text.
## 0.1.2 (2023-06-23)
### Bug fixes
HTML support extensions now work in Angular mode.
### New features
`angular` now allows a base HTML configuration to be passed in.
## 0.1.1 (2023-06-05)
### Bug fixes
Explicitly list @lezer/lr as a dependency.
## 0.1.0 (2022-12-22)
### Breaking changes
First numbered release.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+57
View File
@@ -0,0 +1,57 @@
<!-- NOTE: README.md is generated from src/README.md -->
# @codemirror/lang-angular [![NPM version](https://img.shields.io/npm/v/@codemirror/lang-angular.svg)](https://www.npmjs.org/package/@codemirror/lang-angular)
[ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-angular/blob/main/CHANGELOG.md) ]
This package implements Angular Template language support for the
[CodeMirror](https://codemirror.net/) code editor.
The [project page](https://codemirror.net/) has more information, a
number of [examples](https://codemirror.net/examples/) and the
[documentation](https://codemirror.net/docs/).
This code is released under an
[MIT license](https://github.com/codemirror/lang-json/tree/main/LICENSE).
We aim to be an inclusive, welcoming community. To make that explicit,
we have a [code of
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
to communication around the project.
## Usage
```javascript
import {EditorView, basicSetup} from "codemirror"
import {angular} from "@codemirror/lang-angular"
const view = new EditorView({
parent: document.body,
doc: `<p ng-init="name='Iris'">Hi {{ name }}</p>`,
extensions: [basicSetup, angular()]
})
```
## API Reference
<dl>
<dt id="user-content-angular">
<code><strong><a href="#user-content-angular">angular</a></strong>(<a id="user-content-angular^config" href="#user-content-angular^config">config</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a> = {}) → <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
<dd><p>Angular Template language support.</p>
<dl><dt id="user-content-angular^config">
<code><strong><a href="#user-content-angular^config">config</a></strong></code></dt>
<dd><dl><dt id="user-content-angular^config.base">
<code><strong><a href="#user-content-angular^config.base">base</a></strong>&#8288;?: <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
<dd><p>Provide an HTML language configuration to use as a base. <em>Must</em>
be the result of calling <code>html()</code> from <code>@codemirror/lang-html</code>,
not just any <code>LanguageSupport</code> object.</p>
</dd></dl></dd></dl></dd>
<dt id="user-content-angularlanguage">
<code><strong><a href="#user-content-angularlanguage">angularLanguage</a></strong>: <a href="https://codemirror.net/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>
<dd><p>A language provider for Angular Templates.</p>
</dd>
</dl>
+139
View File
@@ -0,0 +1,139 @@
'use strict';
var language = require('@codemirror/language');
var langHtml = require('@codemirror/lang-html');
var langJavascript = require('@codemirror/lang-javascript');
var highlight = require('@lezer/highlight');
var common = require('@lezer/common');
var lr = require('@lezer/lr');
// This file was generated by lezer-generator. You probably shouldn't edit it.
const Text = 1,
attributeContentSingle = 33,
attributeContentDouble = 34,
scriptAttributeContentSingle = 35,
scriptAttributeContentDouble = 36;
const text = new lr.ExternalTokenizer(input => {
let start = input.pos;
for (;;) {
if (input.next == 10 /* Ch.Newline */) {
input.advance();
break;
}
else if (input.next == 123 /* Ch.BraceL */ && input.peek(1) == 123 /* Ch.BraceL */ || input.next < 0) {
break;
}
input.advance();
}
if (input.pos > start)
input.acceptToken(Text);
});
function attrContent(quote, token, script) {
return new lr.ExternalTokenizer(input => {
let start = input.pos;
while (input.next != quote && input.next >= 0 &&
(script || input.next != 38 /* Ch.Ampersand */ && (input.next != 123 /* Ch.BraceL */ || input.peek(1) != 123 /* Ch.BraceL */)))
input.advance();
if (input.pos > start)
input.acceptToken(token);
});
}
const attrSingle = attrContent(39 /* Ch.SingleQuote */, attributeContentSingle, false);
const attrDouble = attrContent(34 /* Ch.DoubleQuote */, attributeContentDouble, false);
const scriptAttrSingle = attrContent(39 /* Ch.SingleQuote */, scriptAttributeContentSingle, true);
const scriptAttrDouble = attrContent(34 /* Ch.DoubleQuote */, scriptAttributeContentDouble, true);
// This file was generated by lezer-generator. You probably shouldn't edit it.
const parser = lr.LRParser.deserialize({
version: 14,
states: "(jOVOqOOOeQpOOOvO!bO'#CaOOOP'#Cx'#CxQVOqOOO!OQpO'#CfO!WQpO'#ClO!]QpO'#CrO!bQpO'#CsOOQO'#Cv'#CvQ!gQpOOQ!lQpOOQ!qQpOOOOOV,58{,58{O!vOpO,58{OOOP-E6v-E6vO!{QpO,59QO#TQpO,59QOOQO,59W,59WO#YQpO,59^OOQO,59_,59_O#_QpOOO#_QpOOO#gQpOOOOOV1G.g1G.gO#oQpO'#CyO#tQpO1G.lOOQO1G.l1G.lO#|QpO1G.lOOQO1G.x1G.xO$UO`O'#DUO$ZOWO'#DUOOQO'#Co'#CoQOQpOOOOQO'#Cu'#CuO$`OtO'#CwO$qOrO'#CwOOQO,59e,59eOOQO-E6w-E6wOOQO7+$W7+$WO%SQpO7+$WO%[QpO7+$WOOOO'#Cp'#CpO%aOpO,59pOOOO'#Cq'#CqO%fOpO,59pOOOS'#Cz'#CzO%kOtO,59cOOQO,59c,59cOOOQ'#C{'#C{O%|OrO,59cO&_QpO<<GrOOQO<<Gr<<GrOOQO1G/[1G/[OOOS-E6x-E6xOOQO1G.}1G.}OOOQ-E6y-E6yOOQOAN=^AN=^",
stateData: "&d~OvOS~OPROSQOVROWRO~OZTO[XO^VOaUOhWO~OR]OU^O~O[`O^aO~O[bO~O[cO~O[dO~ObeO~ObfO~ObgO~ORhO~O]kOwiO~O[lO~O_mO~OynOzoO~OysOztO~O[uO~O]wOwiO~O_yOwiO~OtzO~Os|O~OSQOV!OOW!OOr!OOy!QO~OSQOV!ROW!ROq!ROz!QO~O_!TOwiO~O]!UO~Oy!VO~Oz!VO~OSQOV!OOW!OOr!OOy!XO~OSQOV!ROW!ROq!ROz!XO~O]!ZO~O",
goto: "#dyPPPPPzPPPP!WPPPPP!WPP!Z!^!a!d!dP!g!j!m!p!v#Q#WPPPPPPPP#^SROSS!Os!PT!Rt!SRYPRqeR{nR}oRZPRqfR[PRqgQSOR_SQj`SvjxRxlQ!PsR!W!PQ!StR!Y!SQpeRrf",
nodeNames: "⚠ Text Content }} {{ Interpolation InterpolationContent Entity InvalidEntity Attribute BoundAttributeName [ Identifier ] ( ) ReferenceName # Is ExpressionAttributeValue AttributeInterpolation AttributeInterpolation EventName DirectiveName * StatementAttributeValue AttributeName AttributeValue",
maxTerm: 42,
nodeProps: [
["openedBy", 3,"{{",15,"("],
["closedBy", 4,"}}",14,")"],
["isolate", -4,5,19,25,27,""]
],
skippedNodes: [0],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j-V;:j;=`$g<%lO+vR-YP;=`<%l+vR-dTwPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR-zTUQbPO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.bTZPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.xT]PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/^VUQO#o#r#o#p/s#p#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/zTSPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#r~0^TO#q#r#q#r0m#r;'S#r;'S;=`$g<%lO#r~0rOR~",
tokenizers: [text, attrSingle, attrDouble, scriptAttrSingle, scriptAttrDouble, 0, 1],
topRules: {"Content":[0,2],"Attribute":[1,9]},
tokenPrec: 0
});
const exprParser = langJavascript.javascriptLanguage.parser.configure({
top: "SingleExpression"
});
const baseParser = parser.configure({
props: [
highlight.styleTags({
Text: highlight.tags.content,
Is: highlight.tags.definitionOperator,
AttributeName: highlight.tags.attributeName,
"AttributeValue ExpressionAttributeValue StatementAttributeValue": highlight.tags.attributeValue,
Entity: highlight.tags.character,
InvalidEntity: highlight.tags.invalid,
"BoundAttributeName/Identifier": highlight.tags.attributeName,
"EventName/Identifier": highlight.tags.special(highlight.tags.attributeName),
"ReferenceName/Identifier": highlight.tags.variableName,
"DirectiveName/Identifier": highlight.tags.keyword,
"{{ }}": highlight.tags.brace,
"( )": highlight.tags.paren,
"[ ]": highlight.tags.bracket,
"# '*'": highlight.tags.punctuation
})
]
});
const exprMixed = { parser: exprParser }, statementMixed = { parser: langJavascript.javascriptLanguage.parser };
const textParser = baseParser.configure({
wrap: common.parseMixed((node, input) => node.name == "InterpolationContent" ? exprMixed : null),
});
const attrParser = baseParser.configure({
wrap: common.parseMixed((node, input) => {
var _a;
return node.name == "InterpolationContent" ? exprMixed
: node.name != "AttributeInterpolation" ? null
: ((_a = node.node.parent) === null || _a === void 0 ? void 0 : _a.name) == "StatementAttributeValue" ? statementMixed : exprMixed;
}),
top: "Attribute"
});
const textMixed = { parser: textParser }, attrMixed = { parser: attrParser };
const baseHTML = langHtml.html({ selfClosingTags: true });
function mkAngular(language) {
return language.configure({ wrap: common.parseMixed(mixAngular) }, "angular");
}
/**
A language provider for Angular Templates.
*/
const angularLanguage = mkAngular(baseHTML.language);
function mixAngular(node, input) {
switch (node.name) {
case "Attribute":
return /^[*#(\[]|\{\{/.test(input.read(node.from, node.to)) ? attrMixed : null;
case "Text":
return textMixed;
}
return null;
}
/**
Angular Template language support.
*/
function angular(config = {}) {
let base = baseHTML;
if (config.base) {
if (config.base.language.name != "html" || !(config.base.language instanceof language.LRLanguage))
throw new RangeError("The base option must be the result of calling html(...)");
base = config.base;
}
return new language.LanguageSupport(base.language == baseHTML.language ? angularLanguage : mkAngular(base.language), [base.support, base.language.data.of({
closeBrackets: { brackets: ["[", "{", '"'] },
indentOnInput: /^\s*[\}\]]$/
})]);
}
exports.angular = angular;
exports.angularLanguage = angularLanguage;
+19
View File
@@ -0,0 +1,19 @@
import { LRLanguage, LanguageSupport } from '@codemirror/language';
/**
A language provider for Angular Templates.
*/
declare const angularLanguage: LRLanguage;
/**
Angular Template language support.
*/
declare function angular(config?: {
/**
Provide an HTML language configuration to use as a base. _Must_
be the result of calling `html()` from `@codemirror/lang-html`,
not just any `LanguageSupport` object.
*/
base?: LanguageSupport;
}): LanguageSupport;
export { angular, angularLanguage };
+19
View File
@@ -0,0 +1,19 @@
import { LRLanguage, LanguageSupport } from '@codemirror/language';
/**
A language provider for Angular Templates.
*/
declare const angularLanguage: LRLanguage;
/**
Angular Template language support.
*/
declare function angular(config?: {
/**
Provide an HTML language configuration to use as a base. _Must_
be the result of calling `html()` from `@codemirror/lang-html`,
not just any `LanguageSupport` object.
*/
base?: LanguageSupport;
}): LanguageSupport;
export { angular, angularLanguage };
+136
View File
@@ -0,0 +1,136 @@
import { LRLanguage, LanguageSupport } from '@codemirror/language';
import { html } from '@codemirror/lang-html';
import { javascriptLanguage } from '@codemirror/lang-javascript';
import { styleTags, tags } from '@lezer/highlight';
import { parseMixed } from '@lezer/common';
import { ExternalTokenizer, LRParser } from '@lezer/lr';
// This file was generated by lezer-generator. You probably shouldn't edit it.
const Text = 1,
attributeContentSingle = 33,
attributeContentDouble = 34,
scriptAttributeContentSingle = 35,
scriptAttributeContentDouble = 36;
const text = /*@__PURE__*/new ExternalTokenizer(input => {
let start = input.pos;
for (;;) {
if (input.next == 10 /* Ch.Newline */) {
input.advance();
break;
}
else if (input.next == 123 /* Ch.BraceL */ && input.peek(1) == 123 /* Ch.BraceL */ || input.next < 0) {
break;
}
input.advance();
}
if (input.pos > start)
input.acceptToken(Text);
});
function attrContent(quote, token, script) {
return new ExternalTokenizer(input => {
let start = input.pos;
while (input.next != quote && input.next >= 0 &&
(script || input.next != 38 /* Ch.Ampersand */ && (input.next != 123 /* Ch.BraceL */ || input.peek(1) != 123 /* Ch.BraceL */)))
input.advance();
if (input.pos > start)
input.acceptToken(token);
});
}
const attrSingle = /*@__PURE__*/attrContent(39 /* Ch.SingleQuote */, attributeContentSingle, false);
const attrDouble = /*@__PURE__*/attrContent(34 /* Ch.DoubleQuote */, attributeContentDouble, false);
const scriptAttrSingle = /*@__PURE__*/attrContent(39 /* Ch.SingleQuote */, scriptAttributeContentSingle, true);
const scriptAttrDouble = /*@__PURE__*/attrContent(34 /* Ch.DoubleQuote */, scriptAttributeContentDouble, true);
// This file was generated by lezer-generator. You probably shouldn't edit it.
const parser = /*@__PURE__*/LRParser.deserialize({
version: 14,
states: "(jOVOqOOOeQpOOOvO!bO'#CaOOOP'#Cx'#CxQVOqOOO!OQpO'#CfO!WQpO'#ClO!]QpO'#CrO!bQpO'#CsOOQO'#Cv'#CvQ!gQpOOQ!lQpOOQ!qQpOOOOOV,58{,58{O!vOpO,58{OOOP-E6v-E6vO!{QpO,59QO#TQpO,59QOOQO,59W,59WO#YQpO,59^OOQO,59_,59_O#_QpOOO#_QpOOO#gQpOOOOOV1G.g1G.gO#oQpO'#CyO#tQpO1G.lOOQO1G.l1G.lO#|QpO1G.lOOQO1G.x1G.xO$UO`O'#DUO$ZOWO'#DUOOQO'#Co'#CoQOQpOOOOQO'#Cu'#CuO$`OtO'#CwO$qOrO'#CwOOQO,59e,59eOOQO-E6w-E6wOOQO7+$W7+$WO%SQpO7+$WO%[QpO7+$WOOOO'#Cp'#CpO%aOpO,59pOOOO'#Cq'#CqO%fOpO,59pOOOS'#Cz'#CzO%kOtO,59cOOQO,59c,59cOOOQ'#C{'#C{O%|OrO,59cO&_QpO<<GrOOQO<<Gr<<GrOOQO1G/[1G/[OOOS-E6x-E6xOOQO1G.}1G.}OOOQ-E6y-E6yOOQOAN=^AN=^",
stateData: "&d~OvOS~OPROSQOVROWRO~OZTO[XO^VOaUOhWO~OR]OU^O~O[`O^aO~O[bO~O[cO~O[dO~ObeO~ObfO~ObgO~ORhO~O]kOwiO~O[lO~O_mO~OynOzoO~OysOztO~O[uO~O]wOwiO~O_yOwiO~OtzO~Os|O~OSQOV!OOW!OOr!OOy!QO~OSQOV!ROW!ROq!ROz!QO~O_!TOwiO~O]!UO~Oy!VO~Oz!VO~OSQOV!OOW!OOr!OOy!XO~OSQOV!ROW!ROq!ROz!XO~O]!ZO~O",
goto: "#dyPPPPPzPPPP!WPPPPP!WPP!Z!^!a!d!dP!g!j!m!p!v#Q#WPPPPPPPP#^SROSS!Os!PT!Rt!SRYPRqeR{nR}oRZPRqfR[PRqgQSOR_SQj`SvjxRxlQ!PsR!W!PQ!StR!Y!SQpeRrf",
nodeNames: "⚠ Text Content }} {{ Interpolation InterpolationContent Entity InvalidEntity Attribute BoundAttributeName [ Identifier ] ( ) ReferenceName # Is ExpressionAttributeValue AttributeInterpolation AttributeInterpolation EventName DirectiveName * StatementAttributeValue AttributeName AttributeValue",
maxTerm: 42,
nodeProps: [
["openedBy", 3,"{{",15,"("],
["closedBy", 4,"}}",14,")"],
["isolate", -4,5,19,25,27,""]
],
skippedNodes: [0],
repeatNodeCount: 4,
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O+vR-YP;=`<%l+vR-dTwPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR-zTUQbPO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.bTZPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.xT]PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/^VUQO#o#r#o#p/s#p#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/zTSPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#r~0^TO#q#r#q#r0m#r;'S#r;'S;=`$g<%lO#r~0rOR~",
tokenizers: [text, attrSingle, attrDouble, scriptAttrSingle, scriptAttrDouble, 0, 1],
topRules: {"Content":[0,2],"Attribute":[1,9]},
tokenPrec: 0
});
const exprParser = /*@__PURE__*/javascriptLanguage.parser.configure({
top: "SingleExpression"
});
const baseParser = /*@__PURE__*/parser.configure({
props: [
/*@__PURE__*/styleTags({
Text: tags.content,
Is: tags.definitionOperator,
AttributeName: tags.attributeName,
"AttributeValue ExpressionAttributeValue StatementAttributeValue": tags.attributeValue,
Entity: tags.character,
InvalidEntity: tags.invalid,
"BoundAttributeName/Identifier": tags.attributeName,
"EventName/Identifier": /*@__PURE__*/tags.special(tags.attributeName),
"ReferenceName/Identifier": tags.variableName,
"DirectiveName/Identifier": tags.keyword,
"{{ }}": tags.brace,
"( )": tags.paren,
"[ ]": tags.bracket,
"# '*'": tags.punctuation
})
]
});
const exprMixed = { parser: exprParser }, statementMixed = { parser: javascriptLanguage.parser };
const textParser = /*@__PURE__*/baseParser.configure({
wrap: /*@__PURE__*/parseMixed((node, input) => node.name == "InterpolationContent" ? exprMixed : null),
});
const attrParser = /*@__PURE__*/baseParser.configure({
wrap: /*@__PURE__*/parseMixed((node, input) => {
var _a;
return node.name == "InterpolationContent" ? exprMixed
: node.name != "AttributeInterpolation" ? null
: ((_a = node.node.parent) === null || _a === void 0 ? void 0 : _a.name) == "StatementAttributeValue" ? statementMixed : exprMixed;
}),
top: "Attribute"
});
const textMixed = { parser: textParser }, attrMixed = { parser: attrParser };
const baseHTML = /*@__PURE__*/html({ selfClosingTags: true });
function mkAngular(language) {
return language.configure({ wrap: parseMixed(mixAngular) }, "angular");
}
/**
A language provider for Angular Templates.
*/
const angularLanguage = /*@__PURE__*/mkAngular(baseHTML.language);
function mixAngular(node, input) {
switch (node.name) {
case "Attribute":
return /^[*#(\[]|\{\{/.test(input.read(node.from, node.to)) ? attrMixed : null;
case "Text":
return textMixed;
}
return null;
}
/**
Angular Template language support.
*/
function angular(config = {}) {
let base = baseHTML;
if (config.base) {
if (config.base.language.name != "html" || !(config.base.language instanceof LRLanguage))
throw new RangeError("The base option must be the result of calling html(...)");
base = config.base;
}
return new LanguageSupport(base.language == baseHTML.language ? angularLanguage : mkAngular(base.language), [base.support, base.language.data.of({
closeBrackets: { brackets: ["[", "{", '"'] },
indentOnInput: /^\s*[\}\]]$/
})]);
}
export { angular, angularLanguage };
+43
View File
@@ -0,0 +1,43 @@
{
"name": "@codemirror/lang-angular",
"version": "0.1.4",
"description": "Angular Template language support for the CodeMirror code editor",
"scripts": {
"test": "cm-runtests",
"prepare": "cm-buildhelper src/angular.ts"
},
"keywords": [
"editor",
"code"
],
"author": {
"name": "Marijn Haverbeke",
"email": "marijn@haverbeke.berlin",
"url": "http://marijnhaverbeke.nl"
},
"type": "module",
"main": "dist/index.cjs",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"types": "dist/index.d.ts",
"module": "dist/index.js",
"sideEffects": false,
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
"@codemirror/lang-html": "^6.0.0",
"@codemirror/lang-javascript": "^6.1.2",
"@lezer/common": "^1.2.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.3.3"
},
"devDependencies": {
"@codemirror/buildhelper": "^1.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/codemirror/lang-angular.git"
}
}