@runeditrun/rer 0.2.83 → 0.2.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/authoring.mjs +1 -0
- package/cli/contract.mjs +1 -1
- package/cli/demo-host.mjs +5 -1
- package/cli/demo.mjs +6 -1
- package/cli/export.mjs +1 -1
- package/cli/parse.mjs +1 -1
- package/edition-authoring/base-copies.mjs +72 -25
- package/edition-authoring/copy-checkout.mjs +7 -120
- package/edition-authoring/edition-migrations.mjs +41 -0
- package/edition-authoring/files.mjs +67 -0
- package/edition-authoring/lock.mjs +2 -2
- package/edition-authoring/module-closure.mjs +232 -0
- package/edition-authoring/module-edges.mjs +100 -0
- package/edition-authoring/module-resolution.mjs +66 -0
- package/edition-authoring/module-syntax.mjs +57 -0
- package/edition-authoring/package-target.mjs +92 -0
- package/edition-authoring/runtime-dependencies.mjs +74 -97
- package/edition-authoring/vendor/babel-parser/LICENSE +22 -0
- package/edition-authoring/vendor/babel-parser/README.md +21 -0
- package/edition-authoring/vendor/babel-parser/babel-helper-string-parser/index.mjs +292 -0
- package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/identifier.mjs +66 -0
- package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/index.mjs +13 -0
- package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/keyword.mjs +31 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/index.mjs +99 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/options.mjs +81 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/bind-operator-errors.mjs +8 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/module-errors.mjs +15 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/parse-expression-errors.mjs +10 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/pipeline-operator-errors.mjs +29 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/standard-errors.mjs +224 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/strict-mode-errors.mjs +17 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/to-node-description.mjs +31 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parse-error.mjs +114 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/base.mjs +34 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/comments.mjs +199 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/expression.mjs +1794 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/index.mjs +76 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/lval.mjs +439 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/node.mjs +111 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/statement.mjs +1962 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/parser/util.mjs +244 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugin-utils.mjs +116 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/estree.mjs +417 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/flow/index.mjs +2412 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/flow/scope.mjs +37 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/jsx/index.mjs +420 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/jsx/xhtml.mjs +261 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/placeholders.mjs +205 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/typescript/index.mjs +2889 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/typescript/scope.mjs +115 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/plugins/v8intrinsic.mjs +26 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/context.mjs +22 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/index.mjs +1037 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/state.mjs +178 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/types.mjs +583 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/types.mjs +1 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/class-scope.mjs +82 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/expression-scope.mjs +121 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/identifier.mjs +23 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/location.mjs +34 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/production-parameter.mjs +40 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/scope.mjs +173 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/scopeflags.mjs +66 -0
- package/edition-authoring/vendor/babel-parser/babel-parser/util/whitespace.mjs +61 -0
- package/edition-authoring/vendor/yaml/LICENSE +13 -0
- package/edition-authoring/vendor/yaml/README.md +11 -0
- package/edition-authoring/vendor/yaml/compose/compose-collection.mjs +88 -0
- package/edition-authoring/vendor/yaml/compose/compose-doc.mjs +43 -0
- package/edition-authoring/vendor/yaml/compose/compose-node.mjs +110 -0
- package/edition-authoring/vendor/yaml/compose/compose-scalar.mjs +86 -0
- package/edition-authoring/vendor/yaml/compose/composer.mjs +218 -0
- package/edition-authoring/vendor/yaml/compose/resolve-block-map.mjs +115 -0
- package/edition-authoring/vendor/yaml/compose/resolve-block-scalar.mjs +198 -0
- package/edition-authoring/vendor/yaml/compose/resolve-block-seq.mjs +49 -0
- package/edition-authoring/vendor/yaml/compose/resolve-end.mjs +37 -0
- package/edition-authoring/vendor/yaml/compose/resolve-flow-collection.mjs +207 -0
- package/edition-authoring/vendor/yaml/compose/resolve-flow-scalar.mjs +228 -0
- package/edition-authoring/vendor/yaml/compose/resolve-props.mjs +148 -0
- package/edition-authoring/vendor/yaml/compose/util-contains-newline.mjs +34 -0
- package/edition-authoring/vendor/yaml/compose/util-empty-scalar-position.mjs +27 -0
- package/edition-authoring/vendor/yaml/compose/util-flow-indent-check.mjs +15 -0
- package/edition-authoring/vendor/yaml/compose/util-map-includes.mjs +13 -0
- package/edition-authoring/vendor/yaml/doc/Document.mjs +333 -0
- package/edition-authoring/vendor/yaml/doc/anchors.mjs +74 -0
- package/edition-authoring/vendor/yaml/doc/applyReviver.mjs +54 -0
- package/edition-authoring/vendor/yaml/doc/createNode.mjs +88 -0
- package/edition-authoring/vendor/yaml/doc/directives.mjs +176 -0
- package/edition-authoring/vendor/yaml/errors.mjs +57 -0
- package/edition-authoring/vendor/yaml/index.mjs +17 -0
- package/edition-authoring/vendor/yaml/log.mjs +11 -0
- package/edition-authoring/vendor/yaml/nodes/Alias.mjs +119 -0
- package/edition-authoring/vendor/yaml/nodes/Collection.mjs +147 -0
- package/edition-authoring/vendor/yaml/nodes/Node.mjs +38 -0
- package/edition-authoring/vendor/yaml/nodes/Pair.mjs +36 -0
- package/edition-authoring/vendor/yaml/nodes/Scalar.mjs +24 -0
- package/edition-authoring/vendor/yaml/nodes/YAMLMap.mjs +144 -0
- package/edition-authoring/vendor/yaml/nodes/YAMLSeq.mjs +113 -0
- package/edition-authoring/vendor/yaml/nodes/addPairToJSMap.mjs +62 -0
- package/edition-authoring/vendor/yaml/nodes/identity.mjs +36 -0
- package/edition-authoring/vendor/yaml/nodes/toJS.mjs +35 -0
- package/edition-authoring/vendor/yaml/parse/cst-scalar.mjs +214 -0
- package/edition-authoring/vendor/yaml/parse/cst-stringify.mjs +61 -0
- package/edition-authoring/vendor/yaml/parse/cst-visit.mjs +97 -0
- package/edition-authoring/vendor/yaml/parse/cst.mjs +98 -0
- package/edition-authoring/vendor/yaml/parse/lexer.mjs +722 -0
- package/edition-authoring/vendor/yaml/parse/line-counter.mjs +39 -0
- package/edition-authoring/vendor/yaml/parse/parser.mjs +975 -0
- package/edition-authoring/vendor/yaml/public-api.mjs +102 -0
- package/edition-authoring/vendor/yaml/schema/Schema.mjs +37 -0
- package/edition-authoring/vendor/yaml/schema/common/map.mjs +17 -0
- package/edition-authoring/vendor/yaml/schema/common/null.mjs +15 -0
- package/edition-authoring/vendor/yaml/schema/common/seq.mjs +17 -0
- package/edition-authoring/vendor/yaml/schema/common/string.mjs +14 -0
- package/edition-authoring/vendor/yaml/schema/core/bool.mjs +19 -0
- package/edition-authoring/vendor/yaml/schema/core/float.mjs +43 -0
- package/edition-authoring/vendor/yaml/schema/core/int.mjs +38 -0
- package/edition-authoring/vendor/yaml/schema/core/schema.mjs +23 -0
- package/edition-authoring/vendor/yaml/schema/json/schema.mjs +62 -0
- package/edition-authoring/vendor/yaml/schema/tags.mjs +96 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/binary.mjs +59 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/bool.mjs +26 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/float.mjs +46 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/int.mjs +71 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/merge.mjs +67 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/omap.mjs +74 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/pairs.mjs +78 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/schema.mjs +39 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/set.mjs +93 -0
- package/edition-authoring/vendor/yaml/schema/yaml-1.1/timestamp.mjs +101 -0
- package/edition-authoring/vendor/yaml/stringify/foldFlowLines.mjs +146 -0
- package/edition-authoring/vendor/yaml/stringify/stringify.mjs +130 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyCollection.mjs +155 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyComment.mjs +20 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyDocument.mjs +85 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyNumber.mjs +25 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyPair.mjs +150 -0
- package/edition-authoring/vendor/yaml/stringify/stringifyString.mjs +338 -0
- package/edition-authoring/vendor/yaml/util.mjs +11 -0
- package/edition-authoring/vendor/yaml/visit.mjs +233 -0
- package/edition-authoring/workflow-copies.mjs +125 -0
- package/edition-authoring/workflow-scripts.mjs +112 -0
- package/foundation/runtime/contract-docs.mjs +753 -0
- package/global/CHANGELOG.md +22 -3
- package/modules/demo/declaration.mjs +1 -4
- package/modules/demo/vite.mjs +1 -1
- package/modules/deploy-kit/README.md +1 -1
- package/modules/deploy-kit/templates.mjs +3 -3
- package/onboarding/operator-installer.mjs +2 -2
- package/package.json +1 -1
- package/scripts/publish-check/README.md +6 -0
- package/scripts/publish-check/history_scan.py +5 -3
- package/scripts/publish-check/hygiene_config.py +2 -1
- package/scripts/publish-check/report.py +9 -3
- package/scripts/publish-check/third-party-notices.json +13 -0
- package/scripts/publish-check/third_party_notices.py +38 -0
- package/scripts/publish-check/tree_scan.py +6 -0
- package/scripts/publish-check.mjs +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
import { Errors } from "../parse-error.mjs";
|
|
3
|
+
class ExpressionScope {
|
|
4
|
+
constructor(type = 0) {
|
|
5
|
+
this.type = type;
|
|
6
|
+
}
|
|
7
|
+
canBeArrowParameterDeclaration() {
|
|
8
|
+
return this.type === 2 || this.type === 1;
|
|
9
|
+
}
|
|
10
|
+
isCertainlyParameterDeclaration() {
|
|
11
|
+
return this.type === 3;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class ArrowHeadParsingScope extends ExpressionScope {
|
|
15
|
+
declarationErrors = /* @__PURE__ */ new Map();
|
|
16
|
+
constructor(type) {
|
|
17
|
+
super(type);
|
|
18
|
+
}
|
|
19
|
+
recordDeclarationError(ParsingErrorClass, at) {
|
|
20
|
+
const index = at.index;
|
|
21
|
+
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
22
|
+
}
|
|
23
|
+
clearDeclarationError(index) {
|
|
24
|
+
this.declarationErrors.delete(index);
|
|
25
|
+
}
|
|
26
|
+
iterateErrors(iterator) {
|
|
27
|
+
this.declarationErrors.forEach(iterator);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class ExpressionScopeHandler {
|
|
31
|
+
parser;
|
|
32
|
+
stack = [new ExpressionScope()];
|
|
33
|
+
constructor(parser) {
|
|
34
|
+
this.parser = parser;
|
|
35
|
+
}
|
|
36
|
+
enter(scope) {
|
|
37
|
+
this.stack.push(scope);
|
|
38
|
+
}
|
|
39
|
+
exit() {
|
|
40
|
+
this.stack.pop();
|
|
41
|
+
}
|
|
42
|
+
recordParameterInitializerError(toParseError, node) {
|
|
43
|
+
const origin = node.loc.start;
|
|
44
|
+
const {
|
|
45
|
+
stack
|
|
46
|
+
} = this;
|
|
47
|
+
let i = stack.length - 1;
|
|
48
|
+
let scope = stack[i];
|
|
49
|
+
while (!scope.isCertainlyParameterDeclaration()) {
|
|
50
|
+
if (scope.canBeArrowParameterDeclaration()) {
|
|
51
|
+
scope.recordDeclarationError(toParseError, origin);
|
|
52
|
+
} else {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
scope = stack[--i];
|
|
56
|
+
}
|
|
57
|
+
this.parser.raise(toParseError, origin);
|
|
58
|
+
}
|
|
59
|
+
recordArrowParameterBindingError(error, node) {
|
|
60
|
+
const {
|
|
61
|
+
stack
|
|
62
|
+
} = this;
|
|
63
|
+
const scope = stack[stack.length - 1];
|
|
64
|
+
const origin = node.loc.start;
|
|
65
|
+
if (scope.isCertainlyParameterDeclaration()) {
|
|
66
|
+
this.parser.raise(error, origin);
|
|
67
|
+
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
68
|
+
scope.recordDeclarationError(error, origin);
|
|
69
|
+
} else {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
recordAsyncArrowParametersError(at) {
|
|
74
|
+
const {
|
|
75
|
+
stack
|
|
76
|
+
} = this;
|
|
77
|
+
let i = stack.length - 1;
|
|
78
|
+
let scope = stack[i];
|
|
79
|
+
while (scope.canBeArrowParameterDeclaration()) {
|
|
80
|
+
if (scope.type === 2) {
|
|
81
|
+
scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
82
|
+
}
|
|
83
|
+
scope = stack[--i];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
validateAsPattern() {
|
|
87
|
+
const {
|
|
88
|
+
stack
|
|
89
|
+
} = this;
|
|
90
|
+
const currentScope = stack[stack.length - 1];
|
|
91
|
+
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
92
|
+
currentScope.iterateErrors(([toParseError, loc]) => {
|
|
93
|
+
this.parser.raise(toParseError, loc);
|
|
94
|
+
let i = stack.length - 2;
|
|
95
|
+
let scope = stack[i];
|
|
96
|
+
while (scope.canBeArrowParameterDeclaration()) {
|
|
97
|
+
scope.clearDeclarationError(loc.index);
|
|
98
|
+
scope = stack[--i];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function newParameterDeclarationScope() {
|
|
104
|
+
return new ExpressionScope(3);
|
|
105
|
+
}
|
|
106
|
+
function newArrowHeadScope() {
|
|
107
|
+
return new ArrowHeadParsingScope(1);
|
|
108
|
+
}
|
|
109
|
+
function newAsyncArrowScope() {
|
|
110
|
+
return new ArrowHeadParsingScope(2);
|
|
111
|
+
}
|
|
112
|
+
function newExpressionScope() {
|
|
113
|
+
return new ExpressionScope();
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
ExpressionScopeHandler as default,
|
|
117
|
+
newArrowHeadScope,
|
|
118
|
+
newAsyncArrowScope,
|
|
119
|
+
newExpressionScope,
|
|
120
|
+
newParameterDeclarationScope
|
|
121
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
import { isIdentifierStart } from "../../babel-helper-validator-identifier/index.mjs";
|
|
3
|
+
import { isIdentifierStart as isIdentifierStart2, isIdentifierChar, isReservedWord, isStrictBindOnlyReservedWord, isStrictBindReservedWord, isStrictReservedWord, isKeyword } from "../../babel-helper-validator-identifier/index.mjs";
|
|
4
|
+
const keywordRelationalOperator = /^in(stanceof)?$/;
|
|
5
|
+
function isIteratorStart(current, next, next2) {
|
|
6
|
+
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
7
|
+
}
|
|
8
|
+
const reservedWordLikeSet = /* @__PURE__ */ new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
|
|
9
|
+
function canBeReservedWord(word) {
|
|
10
|
+
return reservedWordLikeSet.has(word);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
canBeReservedWord,
|
|
14
|
+
isIdentifierChar,
|
|
15
|
+
isIdentifierStart2 as isIdentifierStart,
|
|
16
|
+
isIteratorStart,
|
|
17
|
+
isKeyword,
|
|
18
|
+
isReservedWord,
|
|
19
|
+
isStrictBindOnlyReservedWord,
|
|
20
|
+
isStrictBindReservedWord,
|
|
21
|
+
isStrictReservedWord,
|
|
22
|
+
keywordRelationalOperator
|
|
23
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
class Position {
|
|
3
|
+
line;
|
|
4
|
+
column;
|
|
5
|
+
index;
|
|
6
|
+
constructor(line, col, index) {
|
|
7
|
+
this.line = line;
|
|
8
|
+
this.column = col;
|
|
9
|
+
this.index = index;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class SourceLocation {
|
|
13
|
+
start;
|
|
14
|
+
end;
|
|
15
|
+
filename;
|
|
16
|
+
identifierName;
|
|
17
|
+
constructor(start, end) {
|
|
18
|
+
this.start = start;
|
|
19
|
+
this.end = end;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function createPositionWithColumnOffset(position, columnOffset) {
|
|
23
|
+
const {
|
|
24
|
+
line,
|
|
25
|
+
column,
|
|
26
|
+
index
|
|
27
|
+
} = position;
|
|
28
|
+
return new Position(line, column + columnOffset, index + columnOffset);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
Position,
|
|
32
|
+
SourceLocation,
|
|
33
|
+
createPositionWithColumnOffset
|
|
34
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
var ParamKind = {
|
|
3
|
+
PARAM: 0,
|
|
4
|
+
PARAM_YIELD: 1,
|
|
5
|
+
PARAM_AWAIT: 2,
|
|
6
|
+
PARAM_RETURN: 4,
|
|
7
|
+
PARAM_IN: 8
|
|
8
|
+
};
|
|
9
|
+
class ProductionParameterHandler {
|
|
10
|
+
stacks = [];
|
|
11
|
+
enter(flags) {
|
|
12
|
+
this.stacks.push(flags);
|
|
13
|
+
}
|
|
14
|
+
exit() {
|
|
15
|
+
this.stacks.pop();
|
|
16
|
+
}
|
|
17
|
+
currentFlags() {
|
|
18
|
+
return this.stacks[this.stacks.length - 1];
|
|
19
|
+
}
|
|
20
|
+
get hasAwait() {
|
|
21
|
+
return (this.currentFlags() & ParamKind.PARAM_AWAIT) > 0;
|
|
22
|
+
}
|
|
23
|
+
get hasYield() {
|
|
24
|
+
return (this.currentFlags() & ParamKind.PARAM_YIELD) > 0;
|
|
25
|
+
}
|
|
26
|
+
get hasReturn() {
|
|
27
|
+
return (this.currentFlags() & ParamKind.PARAM_RETURN) > 0;
|
|
28
|
+
}
|
|
29
|
+
get hasIn() {
|
|
30
|
+
return (this.currentFlags() & ParamKind.PARAM_IN) > 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function functionFlags(isAsync, isGenerator) {
|
|
34
|
+
return (isAsync ? ParamKind.PARAM_AWAIT : 0) | (isGenerator ? ParamKind.PARAM_YIELD : 0);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
ParamKind,
|
|
38
|
+
ProductionParameterHandler as default,
|
|
39
|
+
functionFlags
|
|
40
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
import { ScopeFlag, BindingFlag } from "./scopeflags.mjs";
|
|
3
|
+
import { Errors } from "../parse-error.mjs";
|
|
4
|
+
var NameType = {
|
|
5
|
+
Var: 1,
|
|
6
|
+
Lexical: 2,
|
|
7
|
+
Function: 4
|
|
8
|
+
};
|
|
9
|
+
class Scope {
|
|
10
|
+
flags = 0;
|
|
11
|
+
names = /* @__PURE__ */ new Map();
|
|
12
|
+
firstLexicalName = "";
|
|
13
|
+
constructor(flags) {
|
|
14
|
+
this.flags = flags;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class ScopeHandler {
|
|
18
|
+
parser;
|
|
19
|
+
scopeStack = [];
|
|
20
|
+
inModule;
|
|
21
|
+
undefinedExports = /* @__PURE__ */ new Map();
|
|
22
|
+
constructor(parser, inModule) {
|
|
23
|
+
this.parser = parser;
|
|
24
|
+
this.inModule = inModule;
|
|
25
|
+
}
|
|
26
|
+
get inTopLevel() {
|
|
27
|
+
return (this.currentScope().flags & ScopeFlag.PROGRAM) > 0;
|
|
28
|
+
}
|
|
29
|
+
get inFunction() {
|
|
30
|
+
return (this.currentVarScopeFlags() & ScopeFlag.FUNCTION_BASE) > 0;
|
|
31
|
+
}
|
|
32
|
+
get allowSuper() {
|
|
33
|
+
return (this.currentThisScopeFlags() & ScopeFlag.SUPER) > 0;
|
|
34
|
+
}
|
|
35
|
+
get allowDirectSuper() {
|
|
36
|
+
return (this.currentThisScopeFlags() & ScopeFlag.DIRECT_SUPER) > 0;
|
|
37
|
+
}
|
|
38
|
+
get allowNewTarget() {
|
|
39
|
+
return (this.currentThisScopeFlags() & ScopeFlag.NEW_TARGET) > 0;
|
|
40
|
+
}
|
|
41
|
+
get inClass() {
|
|
42
|
+
return (this.currentThisScopeFlags() & ScopeFlag.CLASS_BASE) > 0;
|
|
43
|
+
}
|
|
44
|
+
get inClassAndNotInNonArrowFunction() {
|
|
45
|
+
const flags = this.currentThisScopeFlags();
|
|
46
|
+
return (flags & ScopeFlag.CLASS_BASE) > 0 && (flags & ScopeFlag.FUNCTION_BASE) === 0;
|
|
47
|
+
}
|
|
48
|
+
get inStaticBlock() {
|
|
49
|
+
for (let i = this.scopeStack.length - 1; ; i--) {
|
|
50
|
+
const {
|
|
51
|
+
flags
|
|
52
|
+
} = this.scopeStack[i];
|
|
53
|
+
if (flags & ScopeFlag.STATIC_BLOCK) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (flags & (ScopeFlag.VAR | ScopeFlag.CLASS_BASE)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
get inNonArrowFunction() {
|
|
62
|
+
return (this.currentThisScopeFlags() & ScopeFlag.FUNCTION_BASE) > 0;
|
|
63
|
+
}
|
|
64
|
+
get inBareCaseStatement() {
|
|
65
|
+
return (this.currentScope().flags & ScopeFlag.SWITCH) > 0;
|
|
66
|
+
}
|
|
67
|
+
get treatFunctionsAsVar() {
|
|
68
|
+
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
69
|
+
}
|
|
70
|
+
createScope(flags) {
|
|
71
|
+
return new Scope(flags);
|
|
72
|
+
}
|
|
73
|
+
enter(flags) {
|
|
74
|
+
this.scopeStack.push(this.createScope(flags));
|
|
75
|
+
}
|
|
76
|
+
exit() {
|
|
77
|
+
const scope = this.scopeStack.pop();
|
|
78
|
+
return scope.flags;
|
|
79
|
+
}
|
|
80
|
+
treatFunctionsAsVarInScope(scope) {
|
|
81
|
+
return !!(scope.flags & (ScopeFlag.FUNCTION_BASE | ScopeFlag.STATIC_BLOCK) || !this.parser.inModule && scope.flags & ScopeFlag.PROGRAM);
|
|
82
|
+
}
|
|
83
|
+
declareName(name, bindingType, loc) {
|
|
84
|
+
let scope = this.currentScope();
|
|
85
|
+
if (bindingType & BindingFlag.SCOPE_LEXICAL || bindingType & BindingFlag.SCOPE_FUNCTION) {
|
|
86
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
87
|
+
let type = scope.names.get(name) || 0;
|
|
88
|
+
if (bindingType & BindingFlag.SCOPE_FUNCTION) {
|
|
89
|
+
type = type | NameType.Function;
|
|
90
|
+
} else {
|
|
91
|
+
if (!scope.firstLexicalName) {
|
|
92
|
+
scope.firstLexicalName = name;
|
|
93
|
+
}
|
|
94
|
+
type = type | NameType.Lexical;
|
|
95
|
+
}
|
|
96
|
+
scope.names.set(name, type);
|
|
97
|
+
if (bindingType & BindingFlag.SCOPE_LEXICAL) {
|
|
98
|
+
this.maybeExportDefined(scope, name);
|
|
99
|
+
}
|
|
100
|
+
} else if (bindingType & BindingFlag.SCOPE_VAR) {
|
|
101
|
+
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
102
|
+
scope = this.scopeStack[i];
|
|
103
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
104
|
+
scope.names.set(name, (scope.names.get(name) || 0) | NameType.Var);
|
|
105
|
+
this.maybeExportDefined(scope, name);
|
|
106
|
+
if (scope.flags & ScopeFlag.VAR) break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (this.parser.inModule && scope.flags & ScopeFlag.PROGRAM) {
|
|
110
|
+
this.undefinedExports.delete(name);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
maybeExportDefined(scope, name) {
|
|
114
|
+
if (this.parser.inModule && scope.flags & ScopeFlag.PROGRAM) {
|
|
115
|
+
this.undefinedExports.delete(name);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
119
|
+
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
120
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
121
|
+
identifierName: name
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
isRedeclaredInScope(scope, name, bindingType) {
|
|
126
|
+
if (!(bindingType & BindingFlag.KIND_VALUE)) return false;
|
|
127
|
+
if (bindingType & BindingFlag.SCOPE_LEXICAL) {
|
|
128
|
+
return scope.names.has(name);
|
|
129
|
+
}
|
|
130
|
+
const type = scope.names.get(name) || 0;
|
|
131
|
+
if (bindingType & BindingFlag.SCOPE_FUNCTION) {
|
|
132
|
+
return (type & NameType.Lexical) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & NameType.Var) > 0;
|
|
133
|
+
}
|
|
134
|
+
return (type & NameType.Lexical) > 0 && !(scope.flags & ScopeFlag.SIMPLE_CATCH && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & NameType.Function) > 0;
|
|
135
|
+
}
|
|
136
|
+
checkLocalExport(id) {
|
|
137
|
+
const {
|
|
138
|
+
name
|
|
139
|
+
} = id;
|
|
140
|
+
const topLevelScope = this.scopeStack[0];
|
|
141
|
+
if (!topLevelScope.names.has(name)) {
|
|
142
|
+
this.undefinedExports.set(name, id.loc.start);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
currentScope() {
|
|
146
|
+
return this.scopeStack[this.scopeStack.length - 1];
|
|
147
|
+
}
|
|
148
|
+
currentVarScopeFlags() {
|
|
149
|
+
for (let i = this.scopeStack.length - 1; ; i--) {
|
|
150
|
+
const {
|
|
151
|
+
flags
|
|
152
|
+
} = this.scopeStack[i];
|
|
153
|
+
if (flags & ScopeFlag.VAR) {
|
|
154
|
+
return flags;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
currentThisScopeFlags() {
|
|
159
|
+
for (let i = this.scopeStack.length - 1; ; i--) {
|
|
160
|
+
const {
|
|
161
|
+
flags
|
|
162
|
+
} = this.scopeStack[i];
|
|
163
|
+
if (flags & (ScopeFlag.VAR | ScopeFlag.CLASS_BASE) && !(flags & ScopeFlag.ARROW)) {
|
|
164
|
+
return flags;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
NameType,
|
|
171
|
+
Scope,
|
|
172
|
+
ScopeHandler as default
|
|
173
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
var ScopeFlag = {
|
|
3
|
+
OTHER: 0,
|
|
4
|
+
PROGRAM: 1,
|
|
5
|
+
FUNCTION_BASE: 2,
|
|
6
|
+
ARROW: 4,
|
|
7
|
+
SIMPLE_CATCH: 8,
|
|
8
|
+
SUPER: 16,
|
|
9
|
+
DIRECT_SUPER: 32,
|
|
10
|
+
CLASS_BASE: 64,
|
|
11
|
+
STATIC_BLOCK: 128,
|
|
12
|
+
SWITCH: 256,
|
|
13
|
+
NEW_TARGET: 512,
|
|
14
|
+
TS_MODULE: 1024,
|
|
15
|
+
FUNCTION: 514,
|
|
16
|
+
CLASS: 576,
|
|
17
|
+
VAR: 1667
|
|
18
|
+
};
|
|
19
|
+
var BindingFlag = {
|
|
20
|
+
KIND_VALUE: 1,
|
|
21
|
+
KIND_TYPE: 2,
|
|
22
|
+
SCOPE_VAR: 4,
|
|
23
|
+
SCOPE_LEXICAL: 8,
|
|
24
|
+
SCOPE_FUNCTION: 16,
|
|
25
|
+
SCOPE_OUTSIDE: 32,
|
|
26
|
+
FLAG_NONE: 64,
|
|
27
|
+
FLAG_CLASS: 128,
|
|
28
|
+
FLAG_TS_ENUM: 256,
|
|
29
|
+
FLAG_TS_CONST_ENUM: 512,
|
|
30
|
+
FLAG_TS_EXPORT_ONLY: 1024,
|
|
31
|
+
FLAG_FLOW_DECLARE_FN: 2048,
|
|
32
|
+
FLAG_TS_IMPORT: 4096,
|
|
33
|
+
FLAG_NO_LET_IN_LEXICAL: 8192,
|
|
34
|
+
TYPE_CLASS: 8331,
|
|
35
|
+
TYPE_LEXICAL: 8201,
|
|
36
|
+
TYPE_CATCH_PARAM: 9,
|
|
37
|
+
TYPE_VAR: 5,
|
|
38
|
+
TYPE_FUNCTION: 17,
|
|
39
|
+
TYPE_TS_INTERFACE: 130,
|
|
40
|
+
TYPE_TS_TYPE: 2,
|
|
41
|
+
TYPE_TS_ENUM: 8459,
|
|
42
|
+
TYPE_TS_AMBIENT: 1024,
|
|
43
|
+
TYPE_NONE: 64,
|
|
44
|
+
TYPE_OUTSIDE: 65,
|
|
45
|
+
TYPE_TS_CONST_ENUM: 8971,
|
|
46
|
+
TYPE_TS_NAMESPACE: 1024,
|
|
47
|
+
TYPE_TS_TYPE_IMPORT: 4098,
|
|
48
|
+
TYPE_TS_VALUE_IMPORT: 4096,
|
|
49
|
+
TYPE_FLOW_DECLARE_FN: 2048
|
|
50
|
+
};
|
|
51
|
+
var ClassElementType = {
|
|
52
|
+
OTHER: 0,
|
|
53
|
+
FLAG_STATIC: 4,
|
|
54
|
+
KIND_GETTER: 2,
|
|
55
|
+
KIND_SETTER: 1,
|
|
56
|
+
KIND_ACCESSOR: 3,
|
|
57
|
+
STATIC_GETTER: 6,
|
|
58
|
+
STATIC_SETTER: 5,
|
|
59
|
+
INSTANCE_GETTER: 2,
|
|
60
|
+
INSTANCE_SETTER: 1
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
BindingFlag,
|
|
64
|
+
ClassElementType,
|
|
65
|
+
ScopeFlag
|
|
66
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Generated from Babel v7.29.8 (MIT); see README.md.
|
|
2
|
+
const lineBreak = /\r\n|[\r\n\u2028\u2029]/;
|
|
3
|
+
const lineBreakG = new RegExp(lineBreak.source, "g");
|
|
4
|
+
function isNewLine(code) {
|
|
5
|
+
switch (code) {
|
|
6
|
+
case 10:
|
|
7
|
+
case 13:
|
|
8
|
+
case 8232:
|
|
9
|
+
case 8233:
|
|
10
|
+
return true;
|
|
11
|
+
default:
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function hasNewLine(input, start, end) {
|
|
16
|
+
for (let i = start; i < end; i++) {
|
|
17
|
+
if (isNewLine(input.charCodeAt(i))) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
24
|
+
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
|
|
25
|
+
function isWhitespace(code) {
|
|
26
|
+
switch (code) {
|
|
27
|
+
case 9:
|
|
28
|
+
case 11:
|
|
29
|
+
case 12:
|
|
30
|
+
case 32:
|
|
31
|
+
case 160:
|
|
32
|
+
case 5760:
|
|
33
|
+
case 8192:
|
|
34
|
+
case 8193:
|
|
35
|
+
case 8194:
|
|
36
|
+
case 8195:
|
|
37
|
+
case 8196:
|
|
38
|
+
case 8197:
|
|
39
|
+
case 8198:
|
|
40
|
+
case 8199:
|
|
41
|
+
case 8200:
|
|
42
|
+
case 8201:
|
|
43
|
+
case 8202:
|
|
44
|
+
case 8239:
|
|
45
|
+
case 8287:
|
|
46
|
+
case 12288:
|
|
47
|
+
case 65279:
|
|
48
|
+
return true;
|
|
49
|
+
default:
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
hasNewLine,
|
|
55
|
+
isNewLine,
|
|
56
|
+
isWhitespace,
|
|
57
|
+
lineBreak,
|
|
58
|
+
lineBreakG,
|
|
59
|
+
skipWhiteSpace,
|
|
60
|
+
skipWhiteSpaceInLine
|
|
61
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright Eemeli Aro <eemeli@gmail.com>
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
4
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
5
|
+
and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
9
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
11
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
12
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
13
|
+
THIS SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Vendored yaml 2.9.1 browser ESM distribution.
|
|
2
|
+
Upstream: https://github.com/eemeli/yaml/tree/v2.9.1/browser
|
|
3
|
+
Package: https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz
|
|
4
|
+
License: ISC (LICENSE).
|
|
5
|
+
|
|
6
|
+
Portable CLI packaging changes: .js filenames and relative import links use
|
|
7
|
+
.mjs, making the module format explicit in every adopting package scope.
|
|
8
|
+
Upstream development ESLint directives are removed. Narrow inline annotations
|
|
9
|
+
identify intentional YAML control-character grammar, short-circuit parser
|
|
10
|
+
operations, scanner loops and callback interface parameters. Parser logic is
|
|
11
|
+
unchanged. These annotations apply only to the vendored upstream implementation.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isNode } from '../nodes/identity.mjs';
|
|
2
|
+
import { Scalar } from '../nodes/Scalar.mjs';
|
|
3
|
+
import { YAMLMap } from '../nodes/YAMLMap.mjs';
|
|
4
|
+
import { YAMLSeq } from '../nodes/YAMLSeq.mjs';
|
|
5
|
+
import { resolveBlockMap } from './resolve-block-map.mjs';
|
|
6
|
+
import { resolveBlockSeq } from './resolve-block-seq.mjs';
|
|
7
|
+
import { resolveFlowCollection } from './resolve-flow-collection.mjs';
|
|
8
|
+
|
|
9
|
+
function resolveCollection(CN, ctx, token, onError, tagName, tag) {
|
|
10
|
+
const coll = token.type === 'block-map'
|
|
11
|
+
? resolveBlockMap(CN, ctx, token, onError, tag)
|
|
12
|
+
: token.type === 'block-seq'
|
|
13
|
+
? resolveBlockSeq(CN, ctx, token, onError, tag)
|
|
14
|
+
: resolveFlowCollection(CN, ctx, token, onError, tag);
|
|
15
|
+
const Coll = coll.constructor;
|
|
16
|
+
// If we got a tagName matching the class, or the tag name is '!',
|
|
17
|
+
// then use the tagName from the node class used to create it.
|
|
18
|
+
if (tagName === '!' || tagName === Coll.tagName) {
|
|
19
|
+
coll.tag = Coll.tagName;
|
|
20
|
+
return coll;
|
|
21
|
+
}
|
|
22
|
+
if (tagName)
|
|
23
|
+
coll.tag = tagName;
|
|
24
|
+
return coll;
|
|
25
|
+
}
|
|
26
|
+
function composeCollection(CN, ctx, token, props, onError) {
|
|
27
|
+
const tagToken = props.tag;
|
|
28
|
+
const tagName = !tagToken
|
|
29
|
+
? null
|
|
30
|
+
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
|
|
31
|
+
if (token.type === 'block-seq') {
|
|
32
|
+
const { anchor, newlineAfterProp: nl } = props;
|
|
33
|
+
const lastProp = anchor && tagToken
|
|
34
|
+
? anchor.offset > tagToken.offset
|
|
35
|
+
? anchor
|
|
36
|
+
: tagToken
|
|
37
|
+
: (anchor ?? tagToken);
|
|
38
|
+
if (lastProp && (!nl || nl.offset < lastProp.offset)) {
|
|
39
|
+
const message = 'Missing newline after block sequence props';
|
|
40
|
+
onError(lastProp, 'MISSING_CHAR', message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const expType = token.type === 'block-map'
|
|
44
|
+
? 'map'
|
|
45
|
+
: token.type === 'block-seq'
|
|
46
|
+
? 'seq'
|
|
47
|
+
: token.start.source === '{'
|
|
48
|
+
? 'map'
|
|
49
|
+
: 'seq';
|
|
50
|
+
// shortcut: check if it's a generic YAMLMap or YAMLSeq
|
|
51
|
+
// before jumping into the custom tag logic.
|
|
52
|
+
if (!tagToken ||
|
|
53
|
+
!tagName ||
|
|
54
|
+
tagName === '!' ||
|
|
55
|
+
(tagName === YAMLMap.tagName && expType === 'map') ||
|
|
56
|
+
(tagName === YAMLSeq.tagName && expType === 'seq')) {
|
|
57
|
+
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
58
|
+
}
|
|
59
|
+
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
|
|
60
|
+
if (!tag) {
|
|
61
|
+
const kt = ctx.schema.knownTags[tagName];
|
|
62
|
+
if (kt?.collection === expType) {
|
|
63
|
+
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
64
|
+
tag = kt;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (kt) {
|
|
68
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
72
|
+
}
|
|
73
|
+
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
|
77
|
+
const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
|
|
78
|
+
const node = isNode(res)
|
|
79
|
+
? res
|
|
80
|
+
: new Scalar(res);
|
|
81
|
+
node.range = coll.range;
|
|
82
|
+
node.tag = tagName;
|
|
83
|
+
if (tag?.format)
|
|
84
|
+
node.format = tag.format;
|
|
85
|
+
return node;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { composeCollection };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Document } from '../doc/Document.mjs';
|
|
2
|
+
import { composeNode, composeEmptyNode } from './compose-node.mjs';
|
|
3
|
+
import { resolveEnd } from './resolve-end.mjs';
|
|
4
|
+
import { resolveProps } from './resolve-props.mjs';
|
|
5
|
+
|
|
6
|
+
function composeDoc(options, directives, { offset, start, value, end }, onError) {
|
|
7
|
+
const opts = Object.assign({ _directives: directives }, options);
|
|
8
|
+
const doc = new Document(undefined, opts);
|
|
9
|
+
const ctx = {
|
|
10
|
+
atKey: false,
|
|
11
|
+
atRoot: true,
|
|
12
|
+
directives: doc.directives,
|
|
13
|
+
options: doc.options,
|
|
14
|
+
schema: doc.schema
|
|
15
|
+
};
|
|
16
|
+
const props = resolveProps(start, {
|
|
17
|
+
indicator: 'doc-start',
|
|
18
|
+
next: value ?? end?.[0],
|
|
19
|
+
offset,
|
|
20
|
+
onError,
|
|
21
|
+
parentIndent: 0,
|
|
22
|
+
startOnNewline: true
|
|
23
|
+
});
|
|
24
|
+
if (props.found) {
|
|
25
|
+
doc.directives.docStart = true;
|
|
26
|
+
if (value &&
|
|
27
|
+
(value.type === 'block-map' || value.type === 'block-seq') &&
|
|
28
|
+
!props.hasNewline)
|
|
29
|
+
onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
|
|
30
|
+
}
|
|
31
|
+
// @ts-expect-error If Contents is set, let's trust the user
|
|
32
|
+
doc.contents = value
|
|
33
|
+
? composeNode(ctx, value, props, onError)
|
|
34
|
+
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
35
|
+
const contentEnd = doc.contents.range[2];
|
|
36
|
+
const re = resolveEnd(end, contentEnd, false, onError);
|
|
37
|
+
if (re.comment)
|
|
38
|
+
doc.comment = re.comment;
|
|
39
|
+
doc.range = [offset, contentEnd, re.offset];
|
|
40
|
+
return doc;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { composeDoc };
|