@danielx/civet 0.10.6 → 0.10.7
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/CHANGELOG.md +8 -0
- package/dist/browser.js +83 -38
- package/dist/civet +5 -7
- package/dist/config.js +1 -1
- package/dist/config.mjs +2 -2
- package/dist/esbuild-plugin.js +1 -1
- package/dist/esm.mjs +1 -1
- package/dist/main.js +108 -43
- package/dist/main.mjs +107 -43
- package/dist/types.d.ts +89 -11
- package/dist/unplugin/unplugin.js +2 -4
- package/dist/unplugin/unplugin.mjs +3 -5
- package/package.json +2 -2
- package/register.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
|
|
|
4
4
|
For each version of Civet, it lists and links to all incorporated PRs,
|
|
5
5
|
as well as a full diff and commit list.
|
|
6
6
|
|
|
7
|
+
## 0.10.7 (2025-09-22, [diff](https://github.com/DanielXMoore/Civet/compare/v0.10.6...v0.10.7), [commits](https://github.com/DanielXMoore/Civet/commits/v0.10.7))
|
|
8
|
+
* Support Unicode BOM: UTF-8, UTF-16 LE and BE [[#1792](https://github.com/DanielXMoore/Civet/pull/1792)]
|
|
9
|
+
* Fix access detection in braced expressions [[#1794](https://github.com/DanielXMoore/Civet/pull/1794)]
|
|
10
|
+
* Fix errors in TypeScript types [[#1798](https://github.com/DanielXMoore/Civet/pull/1798)]
|
|
11
|
+
* CLI passes SIGINT etc signals onto ESM scripts [[#1787](https://github.com/DanielXMoore/Civet/pull/1787)]
|
|
12
|
+
* Fix `AutoPromise` wrapper in async functions with complex return types (e.g. OR) [[#1793](https://github.com/DanielXMoore/Civet/pull/1793)]
|
|
13
|
+
* Global configuration of operators via `operators` [[#1799](https://github.com/DanielXMoore/Civet/pull/1799)]
|
|
14
|
+
|
|
7
15
|
## 0.10.6 (2025-09-05, [diff](https://github.com/DanielXMoore/Civet/compare/v0.10.5...v0.10.6), [commits](https://github.com/DanielXMoore/Civet/commits/v0.10.6))
|
|
8
16
|
* Comment and tidy up source mapping util [[#1758](https://github.com/DanielXMoore/Civet/pull/1758)]
|
|
9
17
|
* Throw on esbuild emitDeclaration misconfiguration [[#1759](https://github.com/DanielXMoore/Civet/pull/1759)]
|
package/dist/browser.js
CHANGED
|
@@ -34,9 +34,9 @@ var Civet = (() => {
|
|
|
34
34
|
mod
|
|
35
35
|
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// ../Hera/dist/machine.js
|
|
38
38
|
var require_machine = __commonJS({
|
|
39
|
-
"
|
|
39
|
+
"../Hera/dist/machine.js"(exports, module) {
|
|
40
40
|
"use strict";
|
|
41
41
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
42
42
|
for (var name in all)
|
|
@@ -408,6 +408,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
408
408
|
SourceMap: () => SourceMap2,
|
|
409
409
|
autoRunScripts: () => autoRunScripts,
|
|
410
410
|
compile: () => compile,
|
|
411
|
+
decode: () => decode,
|
|
411
412
|
generate: () => generate_civet_default,
|
|
412
413
|
isCompileError: () => isCompileError,
|
|
413
414
|
lib: () => lib_civet_exports,
|
|
@@ -3114,7 +3115,11 @@ ${js}`
|
|
|
3114
3115
|
message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
3115
3116
|
});
|
|
3116
3117
|
}
|
|
3117
|
-
signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t) && replaceNode(
|
|
3118
|
+
signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t) && replaceNode(
|
|
3119
|
+
signature.returnType.t,
|
|
3120
|
+
wrapTypeInPromise(signature.returnType.t),
|
|
3121
|
+
signature.returnType
|
|
3122
|
+
);
|
|
3118
3123
|
}
|
|
3119
3124
|
function processFunctions(statements, config2) {
|
|
3120
3125
|
for (let ref23 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
|
|
@@ -5699,16 +5704,14 @@ ${js}`
|
|
|
5699
5704
|
] : expression?.type === "ObjectExpression" || expression?.type === "FunctionExpression" && !expression.id || expression?.type === "UnaryExpression" && !expression.pre?.length && expression.expression !== makeExpressionStatement(expression.expression) ? makeLeftHandSideExpression(expression) : expression;
|
|
5700
5705
|
}
|
|
5701
5706
|
function lastAccessInCallExpression(exp) {
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
do {
|
|
5706
|
-
if (exp.children == null)
|
|
5707
|
-
return;
|
|
5708
|
-
for ({ children } = exp, i = children.length - 1; i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"); ) i--;
|
|
5707
|
+
for (; exp.type === "MemberExpression" || exp.type === "CallExpression"; ) {
|
|
5708
|
+
let { children } = exp, i = children.length - 1;
|
|
5709
|
+
for (; i >= 0 && typeof children[i] == "object" && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional"); ) i--;
|
|
5709
5710
|
if (i < 0) return;
|
|
5710
|
-
|
|
5711
|
-
|
|
5711
|
+
exp = children[i];
|
|
5712
|
+
}
|
|
5713
|
+
if (exp.type === "Identifier" || exp.type === "PropertyAccess" || exp.type === "Index")
|
|
5714
|
+
return exp;
|
|
5712
5715
|
}
|
|
5713
5716
|
function convertMethodToFunction(method) {
|
|
5714
5717
|
let { signature, block } = method, { async, modifier, optional } = signature;
|
|
@@ -7409,7 +7412,8 @@ ${js}`
|
|
|
7409
7412
|
SameLineOrIndentedFurther,
|
|
7410
7413
|
Dedented,
|
|
7411
7414
|
PushExtraIndent1
|
|
7412
|
-
}, $L0 = (0, import_lib2.$L)(""), $L1 = (0, import_lib2.$L)("{"), $L2 = (0, import_lib2.$L)("/ "), $L3 = (0, import_lib2.$L)("="), $L4 = (0, import_lib2.$L)("("), $L5 = (0, import_lib2.$L)("... "), $L6 = (0, import_lib2.$L)("?"), $L7 = (0, import_lib2.$L)("."), $L8 = (0, import_lib2.$L)("tuple"), $L9 = (0, import_lib2.$L)("++"), $L10 = (0, import_lib2.$L)("--"), $L11 = (0, import_lib2.$L)("\u29FA"), $L12 = (0, import_lib2.$L)("\u2014"), $L13 = (0, import_lib2.$L)("=>"), $L14 = (0, import_lib2.$L)("\u21D2"), $L15 = (0, import_lib2.$L)("import"), $L16 = (0, import_lib2.$L)(":"), $L17 = (0, import_lib2.$L)(" "), $L18 = (0, import_lib2.$L)("<"), $L19 = (0, import_lib2.$L)("implements"), $L20 = (0, import_lib2.$L)("<:"), $L21 = (0, import_lib2.$L)("^"), $L22 = (0, import_lib2.$L)("<?"), $L23 = (0, import_lib2.$L)("-"), $L24 = (0, import_lib2.$L)("import.meta"), $L25 = (0, import_lib2.$L)("return.value"), $L26 = (0, import_lib2.$L)(","), $L27 = (0, import_lib2.$L)("tighter"), $L28 = (0, import_lib2.$L)("looser"), $L29 = (0, import_lib2.$L)("same"), $L30 = (0, import_lib2.$L)("left"), $L31 = (0, import_lib2.$L)("right"), $L32 = (0, import_lib2.$L)("non"), $L33 = (0, import_lib2.$L)("relational"), $L34 = (0, import_lib2.$L)("arguments"), $L35 = (0, import_lib2.$L)("->"), $L36 = (0, import_lib2.$L)("\u2192"), $L37 = (0, import_lib2.$L)("}"), $L38 = (0, import_lib2.$L)("null"), $L39 = (0, import_lib2.$L)("true"), $L40 = (0, import_lib2.$L)("false"), $L41 = (0, import_lib2.$L)("yes"), $L42 = (0, import_lib2.$L)("on"), $L43 = (0, import_lib2.$L)("no"), $L44 = (0, import_lib2.$L)("off"), $L45 = (0, import_lib2.$L)(">"), $L46 = (0, import_lib2.$L)("]"), $L47 = (0, import_lib2.$L)("\u2022"), $L48 = (0, import_lib2.$L)("//"), $L49 = (0, import_lib2.$L)("**="), $L50 = (0, import_lib2.$L)("*="), $L51 = (0, import_lib2.$L)("%/"), $L52 = (0, import_lib2.$L)("\xF7"), $L53 = (0, import_lib2.$L)("%%"), $L54 = (0, import_lib2.$L)("/="), $L55 = (0, import_lib2.$L)("%="), $L56 = (0, import_lib2.$L)("+="), $L57 = (0, import_lib2.$L)("-="), $L58 = (0, import_lib2.$L)("<<="), $L59 = (0, import_lib2.$L)("\u226A="), $L60 = (0, import_lib2.$L)(">>>="), $L61 = (0, import_lib2.$L)("\u22D9="), $L62 = (0, import_lib2.$L)(">>="), $L63 = (0, import_lib2.$L)("\u226B="), $L64 = (0, import_lib2.$L)("&&="), $L65 = (0, import_lib2.$L)("&="), $L66 = (0, import_lib2.$L)("^="), $L67 = (0, import_lib2.$L)("||="), $L68 = (0, import_lib2.$L)("\u2016="), $L69 = (0, import_lib2.$L)("|="), $L70 = (0, import_lib2.$L)("??="), $L71 = (0, import_lib2.$L)("\u2047="), $L72 = (0, import_lib2.$L)("?="), $L73 = (0, import_lib2.$L)("and="), $L74 = (0, import_lib2.$L)("or="), $L75 = (0, import_lib2.$L)("*"), $L76 = (0, import_lib2.$L)("**"), $L77 = (0, import_lib2.$L)("/"), $L78 = (0, import_lib2.$L)("%"), $L79 = (0, import_lib2.$L)("+"), $L80 = (0, import_lib2.$L)("<="), $L81 = (0, import_lib2.$L)("\u2264"), $L82 = (0, import_lib2.$L)(">="), $L83 = (0, import_lib2.$L)("\u2265"), $L84 = (0, import_lib2.$L)("!<?"), $L85 = (0, import_lib2.$L)("<<"), $L86 = (0, import_lib2.$L)("\u226A"), $L87 = (0, import_lib2.$L)(">>>"), $L88 = (0, import_lib2.$L)("\u22D9"), $L89 = (0, import_lib2.$L)(">>"), $L90 = (0, import_lib2.$L)("\u226B"), $L91 = (0, import_lib2.$L)("!=="), $L92 = (0, import_lib2.$L)("\u2262"), $L93 = (0, import_lib2.$L)("!="), $L94 = (0, import_lib2.$L)("\u2260"), $L95 = (0, import_lib2.$L)("isnt"), $L96 = (0, import_lib2.$L)("==="), $L97 = (0, import_lib2.$L)("\u2263"), $L98 = (0, import_lib2.$L)("\u2A76"), $L99 = (0, import_lib2.$L)("=="), $L100 = (0, import_lib2.$L)("\u2261"), $L101 = (0, import_lib2.$L)("\u2A75"), $L102 = (0, import_lib2.$L)("and"), $L103 = (0, import_lib2.$L)("&&"), $L104 = (0, import_lib2.$L)("or"), $L105 = (0, import_lib2.$L)("||"), $L106 = (0, import_lib2.$L)("\u2016"), $L107 = (0, import_lib2.$L)("^^"), $L108 = (0, import_lib2.$L)("xor"), $L109 = (0, import_lib2.$L)("xnor"), $L110 = (0, import_lib2.$L)("??"), $L111 = (0, import_lib2.$L)("\u2047"), $L112 = (0, import_lib2.$L)("instanceof"), $L113 = (0, import_lib2.$L)("\u2208"), $L114 = (0, import_lib2.$L)("\u220B"), $L115 = (0, import_lib2.$L)("\u220C"), $L116 = (0, import_lib2.$L)("\u2209"), $L117 = (0, import_lib2.$L)("&"), $L118 = (0, import_lib2.$L)("|"), $L119 = (0, import_lib2.$L)(";"), $L120 = (0, import_lib2.$L)("some"), $L121 = (0, import_lib2.$L)("every"), $L122 = (0, import_lib2.$L)("count"), $L123 = (0, import_lib2.$L)("first"), $L124 = (0, import_lib2.$L)("sum"), $L125 = (0, import_lib2.$L)("product"), $L126 = (0, import_lib2.$L)("min"), $L127 = (0, import_lib2.$L)("max"), $L128 = (0, import_lib2.$L)("join"), $L129 = (0, import_lib2.$L)("concat"), $L130 = (0, import_lib2.$L)("break"), $L131 = (0, import_lib2.$L)("continue"), $L132 = (0, import_lib2.$L)("debugger"), $L133 = (0, import_lib2.$L)("require"), $L134 = (0, import_lib2.$L)("with"), $L135 = (0, import_lib2.$L)("assert"), $L136 = (0, import_lib2.$L)(":="), $L137 = (0, import_lib2.$L)("\u2254"), $L138 = (0, import_lib2.$L)(".="), $L139 = (0, import_lib2.$L)("::="), $L140 = (0, import_lib2.$L)("/*"), $L141 = (0, import_lib2.$L)("*/"), $L142 = (0, import_lib2.$L)("\\"), $L143 = (0, import_lib2.$L)(")"), $L144 = (0, import_lib2.$L)("abstract"), $L145 = (0, import_lib2.$L)("as"), $L146 = (0, import_lib2.$L)("@"), $L147 = (0, import_lib2.$L)("@@"), $L148 = (0, import_lib2.$L)("async"), $L149 = (0, import_lib2.$L)("await"), $L150 = (0, import_lib2.$L)("`"), $L151 = (0, import_lib2.$L)("by"), $L152 = (0, import_lib2.$L)("case"), $L153 = (0, import_lib2.$L)("catch"), $L154 = (0, import_lib2.$L)("class"), $L155 = (0, import_lib2.$L)("#{"), $L156 = (0, import_lib2.$L)("comptime"), $L157 = (0, import_lib2.$L)("declare"), $L158 = (0, import_lib2.$L)("default"), $L159 = (0, import_lib2.$L)("delete"), $L160 = (0, import_lib2.$L)("do"), $L161 = (0, import_lib2.$L)(".."), $L162 = (0, import_lib2.$L)("\u2025"), $L163 = (0, import_lib2.$L)("..."), $L164 = (0, import_lib2.$L)("\u2026"), $L165 = (0, import_lib2.$L)("::"), $L166 = (0, import_lib2.$L)('"'), $L167 = (0, import_lib2.$L)("each"), $L168 = (0, import_lib2.$L)("else"), $L169 = (0, import_lib2.$L)("!"), $L170 = (0, import_lib2.$L)("export"), $L171 = (0, import_lib2.$L)("extends"), $L172 = (0, import_lib2.$L)("finally"), $L173 = (0, import_lib2.$L)("for"), $L174 = (0, import_lib2.$L)("from"), $L175 = (0, import_lib2.$L)("function"), $L176 = (0, import_lib2.$L)("get"), $L177 = (0, import_lib2.$L)("set"), $L178 = (0, import_lib2.$L)("#"), $L179 = (0, import_lib2.$L)("if"), $L180 = (0, import_lib2.$L)("in"), $L181 = (0, import_lib2.$L)("infer"), $L182 = (0, import_lib2.$L)("let"), $L183 = (0, import_lib2.$L)("const"), $L184 = (0, import_lib2.$L)("is"), $L185 = (0, import_lib2.$L)("var"), $L186 = (0, import_lib2.$L)("like"), $L187 = (0, import_lib2.$L)("loop"), $L188 = (0, import_lib2.$L)("new"), $L189 = (0, import_lib2.$L)("not"), $L190 = (0, import_lib2.$L)("of"), $L191 = (0, import_lib2.$L)("["), $L192 = (0, import_lib2.$L)("operator"), $L193 = (0, import_lib2.$L)("override"), $L194 = (0, import_lib2.$L)("own"), $L195 = (0, import_lib2.$L)("public"), $L196 = (0, import_lib2.$L)("private"), $L197 = (0, import_lib2.$L)("protected"), $L198 = (0, import_lib2.$L)("||>"), $L199 = (0, import_lib2.$L)("|\u25B7"), $L200 = (0, import_lib2.$L)("|>="), $L201 = (0, import_lib2.$L)("\u25B7="), $L202 = (0, import_lib2.$L)("|>"), $L203 = (0, import_lib2.$L)("\u25B7"), $L204 = (0, import_lib2.$L)("readonly"), $L205 = (0, import_lib2.$L)("return"), $L206 = (0, import_lib2.$L)("satisfies"), $L207 = (0, import_lib2.$L)("'"), $L208 = (0, import_lib2.$L)("static"), $L209 = (0, import_lib2.$L)("${"), $L210 = (0, import_lib2.$L)("super"), $L211 = (0, import_lib2.$L)("switch"), $L212 = (0, import_lib2.$L)("target"), $L213 = (0, import_lib2.$L)("then"), $L214 = (0, import_lib2.$L)("this"), $L215 = (0, import_lib2.$L)("throw"), $L216 = (0, import_lib2.$L)('"""'), $L217 = (0, import_lib2.$L)("'''"), $L218 = (0, import_lib2.$L)("///"), $L219 = (0, import_lib2.$L)("```"), $L220 = (0, import_lib2.$L)("try"), $L221 = (0, import_lib2.$L)("typeof"), $L222 = (0, import_lib2.$L)("undefined"), $L223 = (0, import_lib2.$L)("unless"), $L224 = (0, import_lib2.$L)("until"), $L225 = (0, import_lib2.$L)("using"), $L226 = (0, import_lib2.$L)("void"), $L227 = (0, import_lib2.$L)("when"), $L228 = (0, import_lib2.$L)("while"), $L229 = (0, import_lib2.$L)("yield"), $L230 = (0, import_lib2.$L)("/>"), $L231 = (0, import_lib2.$L)("</"), $L232 = (0, import_lib2.$L)("<>"), $L233 = (0, import_lib2.$L)("</>"), $L234 = (0, import_lib2.$L)("<!--"), $L235 = (0, import_lib2.$L)("-->"), $L236 = (0, import_lib2.$L)("type"), $L237 = (0, import_lib2.$L)("enum"), $L238 = (0, import_lib2.$L)("interface"), $L239 = (0, import_lib2.$L)("global"), $L240 = (0, import_lib2.$L)("module"), $L241 = (0, import_lib2.$L)("namespace"), $L242 = (0, import_lib2.$L)("asserts"), $L243 = (0, import_lib2.$L)("keyof"), $L244 = (0, import_lib2.$L)("???"), $L245 = (0, import_lib2.$L)("unique"), $L246 = (0, import_lib2.$L)("symbol"), $L247 = (0, import_lib2.$L)("[]"), $L248 = (0, import_lib2.$L)("civet"), $R0 = (0, import_lib2.$R)(new RegExp("(?=async|debugger|if|unless|comptime|do|for|loop|until|while|switch|throw|try)", "suy")), $R1 = (0, import_lib2.$R)(new RegExp("&(?=\\s)", "suy")), $R2 = (0, import_lib2.$R)(new RegExp("(as|of|by|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy")), $R3 = (0, import_lib2.$R)(new RegExp("[0-9]", "suy")), $R4 = (0, import_lib2.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy")), $R5 = (0, import_lib2.$R)(new RegExp("[ \\t]", "suy")), $R6 = (0, import_lib2.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#{=]", "suy")), $R7 = (0, import_lib2.$R)(new RegExp("[&=]", "suy")), $R8 = (0, import_lib2.$R)(new RegExp("(?=['\"`])", "suy")), $R9 = (0, import_lib2.$R)(new RegExp("(?=[\\/?])", "suy")), $R10 = (0, import_lib2.$R)(new RegExp("(?=[\\/\\[{?.!@#'\u2019:])", "suy")), $R11 = (0, import_lib2.$R)(new RegExp("%%?", "suy")), $R12 = (0, import_lib2.$R)(new RegExp("[.\\s]", "suy")), $R13 = (0, import_lib2.$R)(new RegExp("[)\\]}]", "suy")), $R14 = (0, import_lib2.$R)(new RegExp("[+-]", "suy")), $R15 = (0, import_lib2.$R)(new RegExp("\\+\\+|--|\u29FA|\u2014|[\\+\\-&]\\S", "suy")), $R16 = (0, import_lib2.$R)(new RegExp(`(?=[0-9.'"tfyno])`, "suy")), $R17 = (0, import_lib2.$R)(new RegExp("(?=true|false|yes|no|on|off)", "suy")), $R18 = (0, import_lib2.$R)(new RegExp("(?=\\p{ID_Start}|[_$])", "suy")), $R19 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy")), $R20 = (0, import_lib2.$R)(new RegExp("(?=\\[|\\s*[.\u2022\\/])", "suy")), $R21 = (0, import_lib2.$R)(new RegExp("([<>])(=?)|([\u2264\u2265])", "suy")), $R22 = (0, import_lib2.$R)(new RegExp("[ \\t]*", "suy")), $R23 = (0, import_lib2.$R)(new RegExp("[ \\t]+", "suy")), $R24 = (0, import_lib2.$R)(new RegExp("[!+-]?", "suy")), $R25 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy")), $R26 = (0, import_lib2.$R)(new RegExp("[=>]", "suy")), $R27 = (0, import_lib2.$R)(new RegExp("(?=\\p{ID_Start}|[_$^\u226A\u226B\u22D9\u2264\u2265\u2208\u220B\u2209\u220C\u2263\u2261\u2262\u2260=\u2A76\u2A75\u2016\u2047&|*\\/!?%\xF7<>\u29FA+-])", "suy")), $R28 = (0, import_lib2.$R)(new RegExp("!\\^\\^?", "suy")), $R29 = (0, import_lib2.$R)(new RegExp("(?!\\+\\+|--)[!~+-](?!\\s)", "suy")), $R30 = (0, import_lib2.$R)(new RegExp("[:.]", "suy")), $R31 = (0, import_lib2.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy")), $R32 = (0, import_lib2.$R)(new RegExp("(?:loop|while|until|for|do)(?!\\p{ID_Continue})", "suy")), $R33 = (0, import_lib2.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy")), $R34 = (0, import_lib2.$R)(new RegExp('[^;"\\s=>]+', "suy")), $R35 = (0, import_lib2.$R)(new RegExp("(?=[0-9.])", "suy")), $R36 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy")), $R37 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy")), $R38 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?:\\.(?:[0-9](?:_[0-9]|[0-9])*))?", "suy")), $R39 = (0, import_lib2.$R)(new RegExp("(?:\\.[0-9](?:_[0-9]|[0-9])*)", "suy")), $R40 = (0, import_lib2.$R)(new RegExp("(?:[eE][+-]?[0-9]+(?:_[0-9]|[0-9])*)", "suy")), $R41 = (0, import_lib2.$R)(new RegExp("0[bB][01](?:[01]|_[01])*n?", "suy")), $R42 = (0, import_lib2.$R)(new RegExp("0[oO][0-7](?:[0-7]|_[0-7])*n?", "suy")), $R43 = (0, import_lib2.$R)(new RegExp("0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_[0-9a-fA-F])*n?", "suy")), $R44 = (0, import_lib2.$R)(new RegExp("(?=[0-9])", "suy")), $R45 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)", "suy")), $R46 = (0, import_lib2.$R)(new RegExp('(?:\\\\.|[^"])*', "suy")), $R47 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^'])*", "suy")), $R48 = (0, import_lib2.$R)(new RegExp('(?:"(?!"")|#(?!\\{)|\\\\.|[^#"])+', "suy")), $R49 = (0, import_lib2.$R)(new RegExp('(?:"(?!"")|\\\\.|[^"])+', "suy")), $R50 = (0, import_lib2.$R)(new RegExp("(?:'(?!'')|\\\\.|[^'])*", "suy")), $R51 = (0, import_lib2.$R)(new RegExp('(?:\\\\.|#(?!\\{)|[^"#])+', "suy")), $R52 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^\\]])*", "suy")), $R53 = (0, import_lib2.$R)(new RegExp("(?:\\\\.)", "suy")), $R54 = (0, import_lib2.$R)(new RegExp("[\\s]+", "suy")), $R55 = (0, import_lib2.$R)(new RegExp("\\/(?!\\/\\/)", "suy")), $R56 = (0, import_lib2.$R)(new RegExp("[^[\\/\\s#$\\\\]+|[#$]", "suy")), $R57 = (0, import_lib2.$R)(new RegExp("[*\\/\\r\\n]", "suy")), $R58 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^[\\/\\r\\n])+", "suy")), $R59 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy")), $R60 = (0, import_lib2.$R)(new RegExp("(?=[`'\"])", "suy")), $R61 = (0, import_lib2.$R)(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy")), $R62 = (0, import_lib2.$R)(new RegExp("(?:\\$(?!\\{)|`(?!``)|\\\\.|[^$`])+", "suy")), $R63 = (0, import_lib2.$R)(new RegExp("(?:on|off|yes|no)(?!\\p{ID_Continue})", "suy")), $R64 = (0, import_lib2.$R)(new RegExp("(?:isnt)(?!\\p{ID_Continue})", "suy")), $R65 = (0, import_lib2.$R)(new RegExp("(?:by)(?!\\p{ID_Continue})", "suy")), $R66 = (0, import_lib2.$R)(new RegExp("(?:of)(?!\\p{ID_Continue})", "suy")), $R67 = (0, import_lib2.$R)(new RegExp("(?:and|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|let|loop|new|not|null|or|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|unless|until|var|void|while|with|yield)(?!\\p{ID_Continue})", "suy")), $R68 = (0, import_lib2.$R)(new RegExp("(?=\\/|#)", "suy")), $R69 = (0, import_lib2.$R)(new RegExp("\\/\\/(?!\\/)[^\\r\\n]*", "suy")), $R70 = (0, import_lib2.$R)(new RegExp(".", "suy")), $R71 = (0, import_lib2.$R)(new RegExp("#(?!##(?!#))([^\\r\\n]*)", "suy")), $R72 = (0, import_lib2.$R)(new RegExp("[^]*?###", "suy")), $R73 = (0, import_lib2.$R)(new RegExp("###(?!#)", "suy")), $R74 = (0, import_lib2.$R)(new RegExp("\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\/", "suy")), $R75 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\/\\\\])", "suy")), $R76 = (0, import_lib2.$R)(new RegExp("(?=\\s|\\/|#)", "suy")), $R77 = (0, import_lib2.$R)(new RegExp("(?!\\p{ID_Continue})", "suy")), $R78 = (0, import_lib2.$R)(new RegExp("[=:]", "suy")), $R79 = (0, import_lib2.$R)(new RegExp("['\u2019]s", "suy")), $R80 = (0, import_lib2.$R)(new RegExp("\\s", "suy")), $R81 = (0, import_lib2.$R)(new RegExp("(?=[<])", "suy")), $R82 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy")), $R83 = (0, import_lib2.$R)(new RegExp("[!+-]", "suy")), $R84 = (0, import_lib2.$R)(new RegExp("[\\s>]|\\/>", "suy")), $R85 = (0, import_lib2.$R)(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy")), $R86 = (0, import_lib2.$R)(new RegExp(`"[^"]*"|'[^']*'`, "suy")), $R87 = (0, import_lib2.$R)(new RegExp("[<>]", "suy")), $R88 = (0, import_lib2.$R)(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy")), $R89 = (0, import_lib2.$R)(new RegExp("(?:-[^-]|[^-]*)*", "suy")), $R90 = (0, import_lib2.$R)(new RegExp("[^{}<>\\r\\n]+", "suy")), $R91 = (0, import_lib2.$R)(new RegExp("[+-]?", "suy")), $R92 = (0, import_lib2.$R)(new RegExp("(?=if|unless)", "suy")), $R93 = (0, import_lib2.$R)(new RegExp("[|&<!=\\-\u21D2\u2192]", "suy")), $R94 = (0, import_lib2.$R)(new RegExp("(extends|not|is)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy")), $R95 = (0, import_lib2.$R)(new RegExp("const|in|out", "suy")), $R96 = (0, import_lib2.$R)(new RegExp("#![^\\r\\n]*", "suy")), $R97 = (0, import_lib2.$R)(new RegExp("[\\t ]*", "suy")), $R98 = (0, import_lib2.$R)(new RegExp("[\\s]*", "suy")), $R99 = (0, import_lib2.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?", "suy")), $R100 = (0, import_lib2.$R)(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy")), $R101 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\r\\n\\/#]|$)", "suy")), $R102 = (0, import_lib2.$R)(new RegExp("\\r\\n|\\n|\\r|$", "suy")), $R103 = (0, import_lib2.$R)(new RegExp("[^]*", "suy")), Program$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Reset, Init, (0, import_lib2.$E)(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
7415
|
+
};
|
|
7416
|
+
var $L0 = (0, import_lib2.$L)(""), $L1 = (0, import_lib2.$L)("{"), $L2 = (0, import_lib2.$L)("/ "), $L3 = (0, import_lib2.$L)("="), $L4 = (0, import_lib2.$L)("("), $L5 = (0, import_lib2.$L)("... "), $L6 = (0, import_lib2.$L)("?"), $L7 = (0, import_lib2.$L)("."), $L8 = (0, import_lib2.$L)("tuple"), $L9 = (0, import_lib2.$L)("++"), $L10 = (0, import_lib2.$L)("--"), $L11 = (0, import_lib2.$L)("\u29FA"), $L12 = (0, import_lib2.$L)("\u2014"), $L13 = (0, import_lib2.$L)("=>"), $L14 = (0, import_lib2.$L)("\u21D2"), $L15 = (0, import_lib2.$L)("import"), $L16 = (0, import_lib2.$L)(":"), $L17 = (0, import_lib2.$L)(" "), $L18 = (0, import_lib2.$L)("<"), $L19 = (0, import_lib2.$L)("implements"), $L20 = (0, import_lib2.$L)("<:"), $L21 = (0, import_lib2.$L)("^"), $L22 = (0, import_lib2.$L)("<?"), $L23 = (0, import_lib2.$L)("-"), $L24 = (0, import_lib2.$L)("import.meta"), $L25 = (0, import_lib2.$L)("return.value"), $L26 = (0, import_lib2.$L)(","), $L27 = (0, import_lib2.$L)("tighter"), $L28 = (0, import_lib2.$L)("looser"), $L29 = (0, import_lib2.$L)("same"), $L30 = (0, import_lib2.$L)("left"), $L31 = (0, import_lib2.$L)("right"), $L32 = (0, import_lib2.$L)("non"), $L33 = (0, import_lib2.$L)("relational"), $L34 = (0, import_lib2.$L)("arguments"), $L35 = (0, import_lib2.$L)("->"), $L36 = (0, import_lib2.$L)("\u2192"), $L37 = (0, import_lib2.$L)("}"), $L38 = (0, import_lib2.$L)("null"), $L39 = (0, import_lib2.$L)("true"), $L40 = (0, import_lib2.$L)("false"), $L41 = (0, import_lib2.$L)("yes"), $L42 = (0, import_lib2.$L)("on"), $L43 = (0, import_lib2.$L)("no"), $L44 = (0, import_lib2.$L)("off"), $L45 = (0, import_lib2.$L)(">"), $L46 = (0, import_lib2.$L)("]"), $L47 = (0, import_lib2.$L)("\u2022"), $L48 = (0, import_lib2.$L)("//"), $L49 = (0, import_lib2.$L)("**="), $L50 = (0, import_lib2.$L)("*="), $L51 = (0, import_lib2.$L)("%/"), $L52 = (0, import_lib2.$L)("\xF7"), $L53 = (0, import_lib2.$L)("%%"), $L54 = (0, import_lib2.$L)("/="), $L55 = (0, import_lib2.$L)("%="), $L56 = (0, import_lib2.$L)("+="), $L57 = (0, import_lib2.$L)("-="), $L58 = (0, import_lib2.$L)("<<="), $L59 = (0, import_lib2.$L)("\u226A="), $L60 = (0, import_lib2.$L)(">>>="), $L61 = (0, import_lib2.$L)("\u22D9="), $L62 = (0, import_lib2.$L)(">>="), $L63 = (0, import_lib2.$L)("\u226B="), $L64 = (0, import_lib2.$L)("&&="), $L65 = (0, import_lib2.$L)("&="), $L66 = (0, import_lib2.$L)("^="), $L67 = (0, import_lib2.$L)("||="), $L68 = (0, import_lib2.$L)("\u2016="), $L69 = (0, import_lib2.$L)("|="), $L70 = (0, import_lib2.$L)("??="), $L71 = (0, import_lib2.$L)("\u2047="), $L72 = (0, import_lib2.$L)("?="), $L73 = (0, import_lib2.$L)("and="), $L74 = (0, import_lib2.$L)("or="), $L75 = (0, import_lib2.$L)("*"), $L76 = (0, import_lib2.$L)("**"), $L77 = (0, import_lib2.$L)("/"), $L78 = (0, import_lib2.$L)("%"), $L79 = (0, import_lib2.$L)("+"), $L80 = (0, import_lib2.$L)("<="), $L81 = (0, import_lib2.$L)("\u2264"), $L82 = (0, import_lib2.$L)(">="), $L83 = (0, import_lib2.$L)("\u2265"), $L84 = (0, import_lib2.$L)("!<?"), $L85 = (0, import_lib2.$L)("<<"), $L86 = (0, import_lib2.$L)("\u226A"), $L87 = (0, import_lib2.$L)(">>>"), $L88 = (0, import_lib2.$L)("\u22D9"), $L89 = (0, import_lib2.$L)(">>"), $L90 = (0, import_lib2.$L)("\u226B"), $L91 = (0, import_lib2.$L)("!=="), $L92 = (0, import_lib2.$L)("\u2262"), $L93 = (0, import_lib2.$L)("!="), $L94 = (0, import_lib2.$L)("\u2260"), $L95 = (0, import_lib2.$L)("isnt"), $L96 = (0, import_lib2.$L)("==="), $L97 = (0, import_lib2.$L)("\u2263"), $L98 = (0, import_lib2.$L)("\u2A76"), $L99 = (0, import_lib2.$L)("=="), $L100 = (0, import_lib2.$L)("\u2261"), $L101 = (0, import_lib2.$L)("\u2A75"), $L102 = (0, import_lib2.$L)("and"), $L103 = (0, import_lib2.$L)("&&"), $L104 = (0, import_lib2.$L)("or"), $L105 = (0, import_lib2.$L)("||"), $L106 = (0, import_lib2.$L)("\u2016"), $L107 = (0, import_lib2.$L)("^^"), $L108 = (0, import_lib2.$L)("xor"), $L109 = (0, import_lib2.$L)("xnor"), $L110 = (0, import_lib2.$L)("??"), $L111 = (0, import_lib2.$L)("\u2047"), $L112 = (0, import_lib2.$L)("instanceof"), $L113 = (0, import_lib2.$L)("\u2208"), $L114 = (0, import_lib2.$L)("\u220B"), $L115 = (0, import_lib2.$L)("\u220C"), $L116 = (0, import_lib2.$L)("\u2209"), $L117 = (0, import_lib2.$L)("&"), $L118 = (0, import_lib2.$L)("|"), $L119 = (0, import_lib2.$L)(";"), $L120 = (0, import_lib2.$L)("some"), $L121 = (0, import_lib2.$L)("every"), $L122 = (0, import_lib2.$L)("count"), $L123 = (0, import_lib2.$L)("first"), $L124 = (0, import_lib2.$L)("sum"), $L125 = (0, import_lib2.$L)("product"), $L126 = (0, import_lib2.$L)("min"), $L127 = (0, import_lib2.$L)("max"), $L128 = (0, import_lib2.$L)("join"), $L129 = (0, import_lib2.$L)("concat"), $L130 = (0, import_lib2.$L)("break"), $L131 = (0, import_lib2.$L)("continue"), $L132 = (0, import_lib2.$L)("debugger"), $L133 = (0, import_lib2.$L)("require"), $L134 = (0, import_lib2.$L)("with"), $L135 = (0, import_lib2.$L)("assert"), $L136 = (0, import_lib2.$L)(":="), $L137 = (0, import_lib2.$L)("\u2254"), $L138 = (0, import_lib2.$L)(".="), $L139 = (0, import_lib2.$L)("::="), $L140 = (0, import_lib2.$L)("/*"), $L141 = (0, import_lib2.$L)("*/"), $L142 = (0, import_lib2.$L)("\\"), $L143 = (0, import_lib2.$L)(")"), $L144 = (0, import_lib2.$L)("abstract"), $L145 = (0, import_lib2.$L)("as"), $L146 = (0, import_lib2.$L)("@"), $L147 = (0, import_lib2.$L)("@@"), $L148 = (0, import_lib2.$L)("async"), $L149 = (0, import_lib2.$L)("await"), $L150 = (0, import_lib2.$L)("`"), $L151 = (0, import_lib2.$L)("by"), $L152 = (0, import_lib2.$L)("case"), $L153 = (0, import_lib2.$L)("catch"), $L154 = (0, import_lib2.$L)("class"), $L155 = (0, import_lib2.$L)("#{"), $L156 = (0, import_lib2.$L)("comptime"), $L157 = (0, import_lib2.$L)("declare"), $L158 = (0, import_lib2.$L)("default"), $L159 = (0, import_lib2.$L)("delete"), $L160 = (0, import_lib2.$L)("do"), $L161 = (0, import_lib2.$L)(".."), $L162 = (0, import_lib2.$L)("\u2025"), $L163 = (0, import_lib2.$L)("..."), $L164 = (0, import_lib2.$L)("\u2026"), $L165 = (0, import_lib2.$L)("::"), $L166 = (0, import_lib2.$L)('"'), $L167 = (0, import_lib2.$L)("each"), $L168 = (0, import_lib2.$L)("else"), $L169 = (0, import_lib2.$L)("!"), $L170 = (0, import_lib2.$L)("export"), $L171 = (0, import_lib2.$L)("extends"), $L172 = (0, import_lib2.$L)("finally"), $L173 = (0, import_lib2.$L)("for"), $L174 = (0, import_lib2.$L)("from"), $L175 = (0, import_lib2.$L)("function"), $L176 = (0, import_lib2.$L)("get"), $L177 = (0, import_lib2.$L)("set"), $L178 = (0, import_lib2.$L)("#"), $L179 = (0, import_lib2.$L)("if"), $L180 = (0, import_lib2.$L)("in"), $L181 = (0, import_lib2.$L)("infer"), $L182 = (0, import_lib2.$L)("let"), $L183 = (0, import_lib2.$L)("const"), $L184 = (0, import_lib2.$L)("is"), $L185 = (0, import_lib2.$L)("var"), $L186 = (0, import_lib2.$L)("like"), $L187 = (0, import_lib2.$L)("loop"), $L188 = (0, import_lib2.$L)("new"), $L189 = (0, import_lib2.$L)("not"), $L190 = (0, import_lib2.$L)("of"), $L191 = (0, import_lib2.$L)("["), $L192 = (0, import_lib2.$L)("operator"), $L193 = (0, import_lib2.$L)("override"), $L194 = (0, import_lib2.$L)("own"), $L195 = (0, import_lib2.$L)("public"), $L196 = (0, import_lib2.$L)("private"), $L197 = (0, import_lib2.$L)("protected"), $L198 = (0, import_lib2.$L)("||>"), $L199 = (0, import_lib2.$L)("|\u25B7"), $L200 = (0, import_lib2.$L)("|>="), $L201 = (0, import_lib2.$L)("\u25B7="), $L202 = (0, import_lib2.$L)("|>"), $L203 = (0, import_lib2.$L)("\u25B7"), $L204 = (0, import_lib2.$L)("readonly"), $L205 = (0, import_lib2.$L)("return"), $L206 = (0, import_lib2.$L)("satisfies"), $L207 = (0, import_lib2.$L)("'"), $L208 = (0, import_lib2.$L)("static"), $L209 = (0, import_lib2.$L)("${"), $L210 = (0, import_lib2.$L)("super"), $L211 = (0, import_lib2.$L)("switch"), $L212 = (0, import_lib2.$L)("target"), $L213 = (0, import_lib2.$L)("then"), $L214 = (0, import_lib2.$L)("this"), $L215 = (0, import_lib2.$L)("throw"), $L216 = (0, import_lib2.$L)('"""'), $L217 = (0, import_lib2.$L)("'''"), $L218 = (0, import_lib2.$L)("///"), $L219 = (0, import_lib2.$L)("```"), $L220 = (0, import_lib2.$L)("try"), $L221 = (0, import_lib2.$L)("typeof"), $L222 = (0, import_lib2.$L)("undefined"), $L223 = (0, import_lib2.$L)("unless"), $L224 = (0, import_lib2.$L)("until"), $L225 = (0, import_lib2.$L)("using"), $L226 = (0, import_lib2.$L)("void"), $L227 = (0, import_lib2.$L)("when"), $L228 = (0, import_lib2.$L)("while"), $L229 = (0, import_lib2.$L)("yield"), $L230 = (0, import_lib2.$L)("/>"), $L231 = (0, import_lib2.$L)("</"), $L232 = (0, import_lib2.$L)("<>"), $L233 = (0, import_lib2.$L)("</>"), $L234 = (0, import_lib2.$L)("<!--"), $L235 = (0, import_lib2.$L)("-->"), $L236 = (0, import_lib2.$L)("type"), $L237 = (0, import_lib2.$L)("enum"), $L238 = (0, import_lib2.$L)("interface"), $L239 = (0, import_lib2.$L)("global"), $L240 = (0, import_lib2.$L)("module"), $L241 = (0, import_lib2.$L)("namespace"), $L242 = (0, import_lib2.$L)("asserts"), $L243 = (0, import_lib2.$L)("keyof"), $L244 = (0, import_lib2.$L)("???"), $L245 = (0, import_lib2.$L)("unique"), $L246 = (0, import_lib2.$L)("symbol"), $L247 = (0, import_lib2.$L)("[]"), $L248 = (0, import_lib2.$L)("civet"), $R0 = (0, import_lib2.$R)(new RegExp("(?=async|debugger|if|unless|comptime|do|for|loop|until|while|switch|throw|try)", "suy")), $R1 = (0, import_lib2.$R)(new RegExp("&(?=\\s)", "suy")), $R2 = (0, import_lib2.$R)(new RegExp("(as|of|by|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy")), $R3 = (0, import_lib2.$R)(new RegExp("[0-9]", "suy")), $R4 = (0, import_lib2.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy")), $R5 = (0, import_lib2.$R)(new RegExp("[ \\t]", "suy")), $R6 = (0, import_lib2.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#{=]", "suy")), $R7 = (0, import_lib2.$R)(new RegExp("[&=]", "suy")), $R8 = (0, import_lib2.$R)(new RegExp("(?=['\"`])", "suy")), $R9 = (0, import_lib2.$R)(new RegExp("(?=[\\/?])", "suy")), $R10 = (0, import_lib2.$R)(new RegExp("(?=[\\/\\[{?.!@#'\u2019:])", "suy")), $R11 = (0, import_lib2.$R)(new RegExp("%%?", "suy")), $R12 = (0, import_lib2.$R)(new RegExp("[.\\s]", "suy")), $R13 = (0, import_lib2.$R)(new RegExp("[)\\]}]", "suy")), $R14 = (0, import_lib2.$R)(new RegExp("[+-]", "suy")), $R15 = (0, import_lib2.$R)(new RegExp("\\+\\+|--|\u29FA|\u2014|[\\+\\-&]\\S", "suy")), $R16 = (0, import_lib2.$R)(new RegExp(`(?=[0-9.'"tfyno])`, "suy")), $R17 = (0, import_lib2.$R)(new RegExp("(?=true|false|yes|no|on|off)", "suy")), $R18 = (0, import_lib2.$R)(new RegExp("(?=\\p{ID_Start}|[_$])", "suy")), $R19 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy")), $R20 = (0, import_lib2.$R)(new RegExp("(?=\\[|\\s*[.\u2022\\/])", "suy")), $R21 = (0, import_lib2.$R)(new RegExp("([<>])(=?)|([\u2264\u2265])", "suy")), $R22 = (0, import_lib2.$R)(new RegExp("[ \\t]*", "suy")), $R23 = (0, import_lib2.$R)(new RegExp("[ \\t]+", "suy")), $R24 = (0, import_lib2.$R)(new RegExp("[!+-]?", "suy")), $R25 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy")), $R26 = (0, import_lib2.$R)(new RegExp("[=>]", "suy")), $R27 = (0, import_lib2.$R)(new RegExp("(?=\\p{ID_Start}|[_$^\u226A\u226B\u22D9\u2264\u2265\u2208\u220B\u2209\u220C\u2263\u2261\u2262\u2260=\u2A76\u2A75\u2016\u2047&|*\\/!?%\xF7<>\u29FA+-])", "suy")), $R28 = (0, import_lib2.$R)(new RegExp("!\\^\\^?", "suy")), $R29 = (0, import_lib2.$R)(new RegExp("(?!\\+\\+|--)[!~+-](?!\\s)", "suy")), $R30 = (0, import_lib2.$R)(new RegExp("[:.]", "suy")), $R31 = (0, import_lib2.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy")), $R32 = (0, import_lib2.$R)(new RegExp("(?:loop|while|until|for|do)(?!\\p{ID_Continue})", "suy")), $R33 = (0, import_lib2.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy")), $R34 = (0, import_lib2.$R)(new RegExp('[^;"\\s=>]+', "suy")), $R35 = (0, import_lib2.$R)(new RegExp("(?=[0-9.])", "suy")), $R36 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy")), $R37 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy")), $R38 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?:\\.(?:[0-9](?:_[0-9]|[0-9])*))?", "suy")), $R39 = (0, import_lib2.$R)(new RegExp("(?:\\.[0-9](?:_[0-9]|[0-9])*)", "suy")), $R40 = (0, import_lib2.$R)(new RegExp("(?:[eE][+-]?[0-9]+(?:_[0-9]|[0-9])*)", "suy")), $R41 = (0, import_lib2.$R)(new RegExp("0[bB][01](?:[01]|_[01])*n?", "suy")), $R42 = (0, import_lib2.$R)(new RegExp("0[oO][0-7](?:[0-7]|_[0-7])*n?", "suy")), $R43 = (0, import_lib2.$R)(new RegExp("0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_[0-9a-fA-F])*n?", "suy")), $R44 = (0, import_lib2.$R)(new RegExp("(?=[0-9])", "suy")), $R45 = (0, import_lib2.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)", "suy")), $R46 = (0, import_lib2.$R)(new RegExp('(?:\\\\.|[^"])*', "suy")), $R47 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^'])*", "suy")), $R48 = (0, import_lib2.$R)(new RegExp('(?:"(?!"")|#(?!\\{)|\\\\.|[^#"])+', "suy")), $R49 = (0, import_lib2.$R)(new RegExp('(?:"(?!"")|\\\\.|[^"])+', "suy")), $R50 = (0, import_lib2.$R)(new RegExp("(?:'(?!'')|\\\\.|[^'])*", "suy")), $R51 = (0, import_lib2.$R)(new RegExp('(?:\\\\.|#(?!\\{)|[^"#])+', "suy")), $R52 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^\\]])*", "suy")), $R53 = (0, import_lib2.$R)(new RegExp("(?:\\\\.)", "suy")), $R54 = (0, import_lib2.$R)(new RegExp("[\\s]+", "suy")), $R55 = (0, import_lib2.$R)(new RegExp("\\/(?!\\/\\/)", "suy")), $R56 = (0, import_lib2.$R)(new RegExp("[^[\\/\\s#$\\\\]+|[#$]", "suy")), $R57 = (0, import_lib2.$R)(new RegExp("[*\\/\\r\\n]", "suy")), $R58 = (0, import_lib2.$R)(new RegExp("(?:\\\\.|[^[\\/\\r\\n])+", "suy")), $R59 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy")), $R60 = (0, import_lib2.$R)(new RegExp("(?=[`'\"])", "suy")), $R61 = (0, import_lib2.$R)(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy")), $R62 = (0, import_lib2.$R)(new RegExp("(?:\\$(?!\\{)|`(?!``)|\\\\.|[^$`])+", "suy")), $R63 = (0, import_lib2.$R)(new RegExp("(?:on|off|yes|no)(?!\\p{ID_Continue})", "suy")), $R64 = (0, import_lib2.$R)(new RegExp("(?:isnt)(?!\\p{ID_Continue})", "suy")), $R65 = (0, import_lib2.$R)(new RegExp("(?:by)(?!\\p{ID_Continue})", "suy")), $R66 = (0, import_lib2.$R)(new RegExp("(?:of)(?!\\p{ID_Continue})", "suy")), $R67 = (0, import_lib2.$R)(new RegExp("(?:and|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|let|loop|new|not|null|or|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|unless|until|var|void|while|with|yield)(?!\\p{ID_Continue})", "suy")), $R68 = (0, import_lib2.$R)(new RegExp("(?=\\/|#)", "suy")), $R69 = (0, import_lib2.$R)(new RegExp("\\/\\/(?!\\/)[^\\r\\n]*", "suy")), $R70 = (0, import_lib2.$R)(new RegExp(".", "suy")), $R71 = (0, import_lib2.$R)(new RegExp("#(?!##(?!#))([^\\r\\n]*)", "suy")), $R72 = (0, import_lib2.$R)(new RegExp("[^]*?###", "suy")), $R73 = (0, import_lib2.$R)(new RegExp("###(?!#)", "suy")), $R74 = (0, import_lib2.$R)(new RegExp("\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\/", "suy")), $R75 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\/\\\\])", "suy")), $R76 = (0, import_lib2.$R)(new RegExp("(?=\\s|\\/|#)", "suy")), $R77 = (0, import_lib2.$R)(new RegExp("(?!\\p{ID_Continue})", "suy")), $R78 = (0, import_lib2.$R)(new RegExp("[=:]", "suy")), $R79 = (0, import_lib2.$R)(new RegExp("['\u2019]s", "suy")), $R80 = (0, import_lib2.$R)(new RegExp("\\s", "suy")), $R81 = (0, import_lib2.$R)(new RegExp("(?=[<])", "suy")), $R82 = (0, import_lib2.$R)(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy")), $R83 = (0, import_lib2.$R)(new RegExp("[!+-]", "suy")), $R84 = (0, import_lib2.$R)(new RegExp("[\\s>]|\\/>", "suy")), $R85 = (0, import_lib2.$R)(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy")), $R86 = (0, import_lib2.$R)(new RegExp(`"[^"]*"|'[^']*'`, "suy")), $R87 = (0, import_lib2.$R)(new RegExp("[<>]", "suy")), $R88 = (0, import_lib2.$R)(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy")), $R89 = (0, import_lib2.$R)(new RegExp("(?:-[^-]|[^-]*)*", "suy")), $R90 = (0, import_lib2.$R)(new RegExp("[^{}<>\\r\\n]+", "suy")), $R91 = (0, import_lib2.$R)(new RegExp("[+-]?", "suy")), $R92 = (0, import_lib2.$R)(new RegExp("(?=if|unless)", "suy")), $R93 = (0, import_lib2.$R)(new RegExp("[|&<!=\\-\u21D2\u2192]", "suy")), $R94 = (0, import_lib2.$R)(new RegExp("(extends|not|is)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy")), $R95 = (0, import_lib2.$R)(new RegExp("const|in|out", "suy")), $R96 = (0, import_lib2.$R)(new RegExp("#![^\\r\\n]*", "suy")), $R97 = (0, import_lib2.$R)(new RegExp("[\\t ]*", "suy")), $R98 = (0, import_lib2.$R)(new RegExp("[\\s]*", "suy")), $R99 = (0, import_lib2.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?", "suy")), $R100 = (0, import_lib2.$R)(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy")), $R101 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\r\\n\\/#]|$)", "suy")), $R102 = (0, import_lib2.$R)(new RegExp("\\r\\n|\\n|\\r|$", "suy")), $R103 = (0, import_lib2.$R)(new RegExp("[^]*", "suy")), Program$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Reset, Init, (0, import_lib2.$E)(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
7413
7417
|
var reset = $1, init = $2, ws1 = $3, statements = $4, ws2 = $5;
|
|
7414
7418
|
let program = {
|
|
7415
7419
|
type: "BlockStatement",
|
|
@@ -9580,10 +9584,10 @@ ${js}`
|
|
|
9580
9584
|
}
|
|
9581
9585
|
var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (0, import_lib2.$E)(OperatorBehavior), _, LexicalDeclaration), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9582
9586
|
var op = $1, behavior = $2, w = $3, decl = $4;
|
|
9583
|
-
return decl.names.forEach((name) =>
|
|
9587
|
+
return decl.names.forEach((name) => setOperatorBehavior(name, behavior)), behavior?.error && (decl = prepend(behavior.error, decl)), decl = prepend(trimFirstSpace(w), decl), decl;
|
|
9584
9588
|
}), OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
9585
9589
|
var signature = $1, block = $2;
|
|
9586
|
-
return
|
|
9590
|
+
return setOperatorBehavior(signature.id.name, signature.behavior), {
|
|
9587
9591
|
...signature,
|
|
9588
9592
|
type: "FunctionExpression",
|
|
9589
9593
|
signature,
|
|
@@ -9594,8 +9598,8 @@ ${js}`
|
|
|
9594
9598
|
}), OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _, Identifier, (0, import_lib2.$E)(OperatorBehavior), (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$E)(_), Identifier, (0, import_lib2.$E)(OperatorBehavior)))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9595
9599
|
var op = $1, w1 = $2, id = $3, behavior = $4, ids = $5;
|
|
9596
9600
|
let children = [];
|
|
9597
|
-
return
|
|
9598
|
-
|
|
9601
|
+
return setOperatorBehavior(id.name, behavior), behavior?.error && children.push(behavior.error), ids.forEach(([, , id2, behavior2]) => {
|
|
9602
|
+
setOperatorBehavior(id2.name, behavior2), behavior2?.error && children.push(behavior2.error);
|
|
9599
9603
|
}), {
|
|
9600
9604
|
id,
|
|
9601
9605
|
children
|
|
@@ -12466,7 +12470,7 @@ ${js}`
|
|
|
12466
12470
|
var i = $1, behavior = $3, ws1 = $4, imports = $5, ws2 = $6, from = $7;
|
|
12467
12471
|
let errors = [];
|
|
12468
12472
|
return behavior?.error && errors.push(behavior.error), imports.specifiers.forEach((spec) => {
|
|
12469
|
-
|
|
12473
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior), spec.behavior?.error && errors.push(spec.behavior.error);
|
|
12470
12474
|
}), {
|
|
12471
12475
|
type: "ImportDeclaration",
|
|
12472
12476
|
children: [i, ...errors, trimFirstSpace(ws1), imports, ws2, from],
|
|
@@ -12496,7 +12500,7 @@ ${js}`
|
|
|
12496
12500
|
var from = $1, fws = $2, i = $3, iws = $4, behavior = $6, ows = $7, imports = $8;
|
|
12497
12501
|
let errors = [];
|
|
12498
12502
|
return behavior?.error && errors.push(behavior.error), imports.specifiers.forEach((spec) => {
|
|
12499
|
-
|
|
12503
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior), spec.behavior?.error && errors.push(spec.behavior.error);
|
|
12500
12504
|
}), {
|
|
12501
12505
|
type: "ImportDeclaration",
|
|
12502
12506
|
children: [i, iws, ...errors, trimFirstSpace(ows), imports, fws, from],
|
|
@@ -12605,7 +12609,7 @@ ${js}`
|
|
|
12605
12609
|
var ws = $1, spec = $3;
|
|
12606
12610
|
if (spec.binding.type !== "Identifier")
|
|
12607
12611
|
throw new Error("Expected identifier after `operator`");
|
|
12608
|
-
return
|
|
12612
|
+
return setOperatorBehavior(spec.binding.name, spec.behavior), {
|
|
12609
12613
|
...spec,
|
|
12610
12614
|
children: [
|
|
12611
12615
|
ws,
|
|
@@ -15542,6 +15546,7 @@ ${js}`
|
|
|
15542
15546
|
break;
|
|
15543
15547
|
case "globals":
|
|
15544
15548
|
case "symbols":
|
|
15549
|
+
case "operators":
|
|
15545
15550
|
value = value.split(",").filter(Boolean);
|
|
15546
15551
|
break;
|
|
15547
15552
|
}
|
|
@@ -15928,6 +15933,28 @@ ${js}`
|
|
|
15928
15933
|
])
|
|
15929
15934
|
config[option] = b;
|
|
15930
15935
|
}
|
|
15936
|
+
}), Object.defineProperty(config, "operators", {
|
|
15937
|
+
set(o) {
|
|
15938
|
+
if (o) {
|
|
15939
|
+
if (typeof o != "object")
|
|
15940
|
+
throw new Error("operators configuration must be an object or array");
|
|
15941
|
+
if (Array.isArray(o))
|
|
15942
|
+
o.forEach((name) => {
|
|
15943
|
+
if (typeof name != "string")
|
|
15944
|
+
throw new Error("operators configuration array must contain only strings");
|
|
15945
|
+
setOperatorBehavior(name, void 0);
|
|
15946
|
+
});
|
|
15947
|
+
else
|
|
15948
|
+
for (let [name, behavior] of Object.entries(o)) {
|
|
15949
|
+
if (typeof behavior == "string" && (behavior = behavior.trim(), behavior = behavior ? parse(behavior, {
|
|
15950
|
+
startRule: "OperatorBehavior",
|
|
15951
|
+
filename: `operator config for ${name}`
|
|
15952
|
+
}) : void 0), behavior && typeof behavior != "object")
|
|
15953
|
+
throw new Error("operators configuration object must have string or object values");
|
|
15954
|
+
setOperatorBehavior(name, behavior);
|
|
15955
|
+
}
|
|
15956
|
+
}
|
|
15957
|
+
}
|
|
15931
15958
|
}), Object.assign(config, initialConfig);
|
|
15932
15959
|
});
|
|
15933
15960
|
function Reset(ctx, state2) {
|
|
@@ -16032,23 +16059,21 @@ ${js}`
|
|
|
16032
16059
|
function PushExtraIndent1(ctx, state2) {
|
|
16033
16060
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushExtraIndent1", PushExtraIndent1$0);
|
|
16034
16061
|
}
|
|
16035
|
-
var parser =
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
};
|
|
16051
|
-
}();
|
|
16062
|
+
var parser = {
|
|
16063
|
+
parse: (input, options = {}) => {
|
|
16064
|
+
let { fail, validate, reset } = (0, import_lib2.Validator)(), ctx = { expectation: "", fail };
|
|
16065
|
+
if (typeof input != "string") throw new Error("Input must be a string");
|
|
16066
|
+
let parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
16067
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
16068
|
+
let filename2 = options.filename || "<anonymous>";
|
|
16069
|
+
return reset(), Object.assign(ctx, { ...options.events, tokenize: options.tokenize }), validate(input, parser2(ctx, {
|
|
16070
|
+
input,
|
|
16071
|
+
pos: 0
|
|
16072
|
+
}), {
|
|
16073
|
+
filename: filename2
|
|
16074
|
+
});
|
|
16075
|
+
}
|
|
16076
|
+
};
|
|
16052
16077
|
var { parse } = parser;
|
|
16053
16078
|
var filename, initialConfig, config, sync, state = {
|
|
16054
16079
|
// parser state
|
|
@@ -16118,6 +16143,10 @@ ${js}`
|
|
|
16118
16143
|
}
|
|
16119
16144
|
}
|
|
16120
16145
|
});
|
|
16146
|
+
function setOperatorBehavior(name, behavior) {
|
|
16147
|
+
let existing = state.operators.get(name);
|
|
16148
|
+
existing && behavior ? state.operators.set(name, { ...existing, ...behavior }) : state.operators.set(name, behavior || existing);
|
|
16149
|
+
}
|
|
16121
16150
|
function getStateKey() {
|
|
16122
16151
|
return [state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
|
|
16123
16152
|
// since it is affected by the directive prologue and may be hit
|
|
@@ -16414,8 +16443,24 @@ ${upstreamMap.comment(sourcePath, targetPath)}`;
|
|
|
16414
16443
|
"RestoreNewlineBinaryOp",
|
|
16415
16444
|
"RestorePipeline"
|
|
16416
16445
|
]);
|
|
16446
|
+
function decode(src) {
|
|
16447
|
+
if (typeof src == "string" || typeof Buffer > "u" || !Buffer?.isBuffer(src))
|
|
16448
|
+
return src;
|
|
16449
|
+
if (src[0] === 239 && src[1] === 187 && src[2] === 191)
|
|
16450
|
+
return src.toString("utf8", 3);
|
|
16451
|
+
if (src[0] === 255 && src[1] === 254)
|
|
16452
|
+
return src.toString("utf16le", 2);
|
|
16453
|
+
if (src[0] === 254 && src[1] === 255) {
|
|
16454
|
+
for (let end = src.length - 2, i1 = 2; i1 <= end; i1 += 2) {
|
|
16455
|
+
let i = i1;
|
|
16456
|
+
[src[i], src[i + 1]] = [src[i + 1], src[i]];
|
|
16457
|
+
}
|
|
16458
|
+
return src.toString("utf16le", 2);
|
|
16459
|
+
} else
|
|
16460
|
+
return src.toString("utf8");
|
|
16461
|
+
}
|
|
16417
16462
|
function compile(src, options) {
|
|
16418
|
-
options ? options = { ...options } : options = {}, options.parseOptions = { ...options.parseOptions };
|
|
16463
|
+
src = decode(src), options ? options = { ...options } : options = {}, options.parseOptions = { ...options.parseOptions };
|
|
16419
16464
|
let filename2 = options.filename || "unknown";
|
|
16420
16465
|
filename2.endsWith(".coffee") && !/^(#![^\r\n]*(\r\n|\n|\r))?\s*['"]civet/.test(src) && (options.parseOptions.coffeeCompat = !0);
|
|
16421
16466
|
let { hits, trace, noCache } = options, events;
|
package/dist/civet
CHANGED
|
@@ -133,12 +133,7 @@ async function parseArgs(args, isTTY = process.stdin.isTTY) {
|
|
|
133
133
|
options.parseOptions ??= {},
|
|
134
134
|
(0, import_main.parse)(`civet ${args[++i]}`, {
|
|
135
135
|
startRule: "CivetPrologueContent",
|
|
136
|
-
filename: "--civet argument"
|
|
137
|
-
events: {
|
|
138
|
-
// remove cache in case we've compiled Civet before
|
|
139
|
-
enter: void 0,
|
|
140
|
-
exit: void 0
|
|
141
|
-
}
|
|
136
|
+
filename: "--civet argument"
|
|
142
137
|
}).config
|
|
143
138
|
);
|
|
144
139
|
break;
|
|
@@ -284,7 +279,7 @@ async function* readFiles(filenames, evalString) {
|
|
|
284
279
|
})()).join("");
|
|
285
280
|
}
|
|
286
281
|
} else {
|
|
287
|
-
content = await import_promises.default.readFile(filename
|
|
282
|
+
content = await import_promises.default.readFile(filename);
|
|
288
283
|
}
|
|
289
284
|
yield { filename, content, stdin };
|
|
290
285
|
} catch (error) {
|
|
@@ -664,6 +659,9 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
664
659
|
}
|
|
665
660
|
return process.exit(code ?? 1);
|
|
666
661
|
});
|
|
662
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
663
|
+
process.on(signal, () => child.kill(signal));
|
|
664
|
+
}
|
|
667
665
|
} else {
|
|
668
666
|
await import("../register.js");
|
|
669
667
|
try {
|
package/dist/config.js
CHANGED
|
@@ -101,7 +101,7 @@ async function findConfig(startDir) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
async function loadConfig(pathname) {
|
|
104
|
-
const config = await import_promises.default.readFile(pathname
|
|
104
|
+
const config = (0, import_main.decode)(await import_promises.default.readFile(pathname));
|
|
105
105
|
let data = {};
|
|
106
106
|
if (pathname.endsWith(".json")) {
|
|
107
107
|
let json;
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\config.civet.jsx
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
|
-
import { compile } from "./main.mjs";
|
|
4
|
+
import { decode, compile } from "./main.mjs";
|
|
5
5
|
var configNames = [
|
|
6
6
|
"\u{1F408}",
|
|
7
7
|
"civetconfig",
|
|
@@ -65,7 +65,7 @@ async function findConfig(startDir) {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
async function loadConfig(pathname) {
|
|
68
|
-
const config = await fs.readFile(pathname
|
|
68
|
+
const config = decode(await fs.readFile(pathname));
|
|
69
69
|
let data = {};
|
|
70
70
|
if (pathname.endsWith(".json")) {
|
|
71
71
|
let json;
|
package/dist/esbuild-plugin.js
CHANGED
|
@@ -87,7 +87,7 @@ var civet = function(options = {}) {
|
|
|
87
87
|
});
|
|
88
88
|
return build.onLoad({ filter }, async function(args) {
|
|
89
89
|
try {
|
|
90
|
-
const source = await (0, import_promises.readFile)(args.path
|
|
90
|
+
const source = await (0, import_promises.readFile)(args.path);
|
|
91
91
|
const filename = import_path.default.relative(process.cwd(), args.path);
|
|
92
92
|
const compiled = await (0, import_main.compile)(source, {
|
|
93
93
|
filename,
|
package/dist/esm.mjs
CHANGED
|
@@ -24,7 +24,7 @@ function resolve(specifier, context, next) {
|
|
|
24
24
|
async function load(url, context, next) {
|
|
25
25
|
if (context.format === "civet") {
|
|
26
26
|
const path = fileURLToPath(url);
|
|
27
|
-
const source = await readFile(path
|
|
27
|
+
const source = await readFile(path);
|
|
28
28
|
let loadedConfig;
|
|
29
29
|
let { config } = globalOptions;
|
|
30
30
|
if (config === void 0) {
|
package/dist/main.js
CHANGED
|
@@ -29,9 +29,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
));
|
|
30
30
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
31
|
|
|
32
|
-
//
|
|
32
|
+
// ../Hera/dist/machine.js
|
|
33
33
|
var require_machine = __commonJS({
|
|
34
|
-
"
|
|
34
|
+
"../Hera/dist/machine.js"(exports2, module2) {
|
|
35
35
|
"use strict";
|
|
36
36
|
var __defProp2 = Object.defineProperty;
|
|
37
37
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -490,6 +490,7 @@ __export(main_civet_exports, {
|
|
|
490
490
|
ParseErrors: () => ParseErrors,
|
|
491
491
|
SourceMap: () => SourceMap2,
|
|
492
492
|
compile: () => compile,
|
|
493
|
+
decode: () => decode,
|
|
493
494
|
default: () => main_civet_default,
|
|
494
495
|
generate: () => generate_civet_default,
|
|
495
496
|
isCompileError: () => isCompileError,
|
|
@@ -4043,7 +4044,11 @@ function processSignature(f) {
|
|
|
4043
4044
|
}
|
|
4044
4045
|
}
|
|
4045
4046
|
if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
|
|
4046
|
-
replaceNode(
|
|
4047
|
+
replaceNode(
|
|
4048
|
+
signature.returnType.t,
|
|
4049
|
+
wrapTypeInPromise(signature.returnType.t),
|
|
4050
|
+
signature.returnType
|
|
4051
|
+
);
|
|
4047
4052
|
}
|
|
4048
4053
|
}
|
|
4049
4054
|
function processFunctions(statements, config2) {
|
|
@@ -7646,21 +7651,18 @@ function makeExpressionStatement(expression) {
|
|
|
7646
7651
|
}
|
|
7647
7652
|
}
|
|
7648
7653
|
function lastAccessInCallExpression(exp) {
|
|
7649
|
-
|
|
7654
|
+
while (exp.type === "MemberExpression" || exp.type === "CallExpression") {
|
|
7655
|
+
const { children } = exp;
|
|
7656
|
+
let i = children.length - 1;
|
|
7657
|
+
while (i >= 0 && typeof children[i] === "object" && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7658
|
+
if (i < 0) return;
|
|
7659
|
+
exp = children[i];
|
|
7660
|
+
}
|
|
7661
|
+
if (exp.type === "Identifier" || exp.type === "PropertyAccess" || exp.type === "Index") {
|
|
7650
7662
|
return exp;
|
|
7651
7663
|
}
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
if (!(exp.children != null)) {
|
|
7655
|
-
return;
|
|
7656
|
-
}
|
|
7657
|
-
;
|
|
7658
|
-
({ children } = exp);
|
|
7659
|
-
i = children.length - 1;
|
|
7660
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7661
|
-
if (i < 0) return;
|
|
7662
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
7663
|
-
return children[i];
|
|
7664
|
+
;
|
|
7665
|
+
return;
|
|
7664
7666
|
}
|
|
7665
7667
|
function convertMethodToFunction(method) {
|
|
7666
7668
|
const { signature, block } = method;
|
|
@@ -13010,7 +13012,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
13010
13012
|
var behavior = $2;
|
|
13011
13013
|
var w = $3;
|
|
13012
13014
|
var decl = $4;
|
|
13013
|
-
decl.names.forEach((name) =>
|
|
13015
|
+
decl.names.forEach((name) => setOperatorBehavior(name, behavior));
|
|
13014
13016
|
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
13015
13017
|
decl = prepend(trimFirstSpace(w), decl);
|
|
13016
13018
|
return decl;
|
|
@@ -13018,7 +13020,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
13018
13020
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
13019
13021
|
var signature = $1;
|
|
13020
13022
|
var block = $2;
|
|
13021
|
-
|
|
13023
|
+
setOperatorBehavior(signature.id.name, signature.behavior);
|
|
13022
13024
|
return {
|
|
13023
13025
|
...signature,
|
|
13024
13026
|
type: "FunctionExpression",
|
|
@@ -13035,10 +13037,10 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
13035
13037
|
var behavior = $4;
|
|
13036
13038
|
var ids = $5;
|
|
13037
13039
|
const children = [];
|
|
13038
|
-
|
|
13040
|
+
setOperatorBehavior(id.name, behavior);
|
|
13039
13041
|
if (behavior?.error) children.push(behavior.error);
|
|
13040
13042
|
ids.forEach(([, , id2, behavior2]) => {
|
|
13041
|
-
|
|
13043
|
+
setOperatorBehavior(id2.name, behavior2);
|
|
13042
13044
|
if (behavior2?.error) children.push(behavior2.error);
|
|
13043
13045
|
});
|
|
13044
13046
|
return {
|
|
@@ -16771,7 +16773,7 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16771
16773
|
const errors = [];
|
|
16772
16774
|
if (behavior?.error) errors.push(behavior.error);
|
|
16773
16775
|
imports.specifiers.forEach((spec) => {
|
|
16774
|
-
|
|
16776
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16775
16777
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16776
16778
|
});
|
|
16777
16779
|
return {
|
|
@@ -16822,7 +16824,7 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, _
|
|
|
16822
16824
|
const errors = [];
|
|
16823
16825
|
if (behavior?.error) errors.push(behavior.error);
|
|
16824
16826
|
imports.specifiers.forEach((spec) => {
|
|
16825
|
-
|
|
16827
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16826
16828
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16827
16829
|
});
|
|
16828
16830
|
return {
|
|
@@ -16954,7 +16956,7 @@ var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Oper
|
|
|
16954
16956
|
if (spec.binding.type !== "Identifier") {
|
|
16955
16957
|
throw new Error("Expected identifier after `operator`");
|
|
16956
16958
|
}
|
|
16957
|
-
|
|
16959
|
+
setOperatorBehavior(spec.binding.name, spec.behavior);
|
|
16958
16960
|
return {
|
|
16959
16961
|
...spec,
|
|
16960
16962
|
children: [
|
|
@@ -20550,6 +20552,7 @@ var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOp
|
|
|
20550
20552
|
break;
|
|
20551
20553
|
case "globals":
|
|
20552
20554
|
case "symbols":
|
|
20555
|
+
case "operators":
|
|
20553
20556
|
value = value.split(",").filter(Boolean);
|
|
20554
20557
|
break;
|
|
20555
20558
|
}
|
|
@@ -20958,6 +20961,36 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20958
20961
|
}
|
|
20959
20962
|
}
|
|
20960
20963
|
});
|
|
20964
|
+
Object.defineProperty(config, "operators", {
|
|
20965
|
+
set(o) {
|
|
20966
|
+
if (!o) return;
|
|
20967
|
+
if (typeof o !== "object") {
|
|
20968
|
+
throw new Error("operators configuration must be an object or array");
|
|
20969
|
+
}
|
|
20970
|
+
if (Array.isArray(o)) {
|
|
20971
|
+
o.forEach((name) => {
|
|
20972
|
+
if (typeof name !== "string") {
|
|
20973
|
+
throw new Error("operators configuration array must contain only strings");
|
|
20974
|
+
}
|
|
20975
|
+
setOperatorBehavior(name, void 0);
|
|
20976
|
+
});
|
|
20977
|
+
} else {
|
|
20978
|
+
for (let [name, behavior] of Object.entries(o)) {
|
|
20979
|
+
if (typeof behavior === "string") {
|
|
20980
|
+
behavior = behavior.trim();
|
|
20981
|
+
behavior = behavior ? parse(behavior, {
|
|
20982
|
+
startRule: "OperatorBehavior",
|
|
20983
|
+
filename: `operator config for ${name}`
|
|
20984
|
+
}) : void 0;
|
|
20985
|
+
}
|
|
20986
|
+
if (behavior && typeof behavior !== "object") {
|
|
20987
|
+
throw new Error("operators configuration object must have string or object values");
|
|
20988
|
+
}
|
|
20989
|
+
setOperatorBehavior(name, behavior);
|
|
20990
|
+
}
|
|
20991
|
+
}
|
|
20992
|
+
}
|
|
20993
|
+
});
|
|
20961
20994
|
Object.assign(config, initialConfig);
|
|
20962
20995
|
});
|
|
20963
20996
|
function Reset(ctx, state2) {
|
|
@@ -21089,26 +21122,24 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
21089
21122
|
function PushExtraIndent1(ctx, state2) {
|
|
21090
21123
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushExtraIndent1", PushExtraIndent1$0);
|
|
21091
21124
|
}
|
|
21092
|
-
var parser =
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
};
|
|
21111
|
-
}();
|
|
21125
|
+
var parser = {
|
|
21126
|
+
parse: (input, options = {}) => {
|
|
21127
|
+
const { fail, validate, reset } = (0, import_lib2.Validator)();
|
|
21128
|
+
let ctx = { expectation: "", fail };
|
|
21129
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
21130
|
+
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
21131
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
21132
|
+
const filename2 = options.filename || "<anonymous>";
|
|
21133
|
+
reset();
|
|
21134
|
+
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
21135
|
+
return validate(input, parser2(ctx, {
|
|
21136
|
+
input,
|
|
21137
|
+
pos: 0
|
|
21138
|
+
}), {
|
|
21139
|
+
filename: filename2
|
|
21140
|
+
});
|
|
21141
|
+
}
|
|
21142
|
+
};
|
|
21112
21143
|
var { parse } = parser;
|
|
21113
21144
|
var filename;
|
|
21114
21145
|
var initialConfig;
|
|
@@ -21187,6 +21218,14 @@ Object.defineProperties(state, {
|
|
|
21187
21218
|
}
|
|
21188
21219
|
}
|
|
21189
21220
|
});
|
|
21221
|
+
function setOperatorBehavior(name, behavior) {
|
|
21222
|
+
const existing = state.operators.get(name);
|
|
21223
|
+
if (existing && behavior) {
|
|
21224
|
+
state.operators.set(name, { ...existing, ...behavior });
|
|
21225
|
+
} else {
|
|
21226
|
+
state.operators.set(name, behavior || existing);
|
|
21227
|
+
}
|
|
21228
|
+
}
|
|
21190
21229
|
function getStateKey() {
|
|
21191
21230
|
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
|
|
21192
21231
|
// since it is affected by the directive prologue and may be hit
|
|
@@ -21747,7 +21786,32 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
21747
21786
|
"RestorePipeline"
|
|
21748
21787
|
]);
|
|
21749
21788
|
var workerPool;
|
|
21789
|
+
function decode(src) {
|
|
21790
|
+
if (typeof src === "string") {
|
|
21791
|
+
return src;
|
|
21792
|
+
}
|
|
21793
|
+
if (typeof Buffer === "undefined") {
|
|
21794
|
+
return src;
|
|
21795
|
+
}
|
|
21796
|
+
if (!Buffer?.isBuffer(src)) {
|
|
21797
|
+
return src;
|
|
21798
|
+
}
|
|
21799
|
+
if (src[0] === 239 && src[1] === 187 && src[2] === 191) {
|
|
21800
|
+
return src.toString("utf8", 3);
|
|
21801
|
+
} else if (src[0] === 255 && src[1] === 254) {
|
|
21802
|
+
return src.toString("utf16le", 2);
|
|
21803
|
+
} else if (src[0] === 254 && src[1] === 255) {
|
|
21804
|
+
for (let end = src.length - 2, i1 = 2; i1 <= end; i1 += 2) {
|
|
21805
|
+
const i = i1;
|
|
21806
|
+
[src[i], src[i + 1]] = [src[i + 1], src[i]];
|
|
21807
|
+
}
|
|
21808
|
+
return src.toString("utf16le", 2);
|
|
21809
|
+
} else {
|
|
21810
|
+
return src.toString("utf8");
|
|
21811
|
+
}
|
|
21812
|
+
}
|
|
21750
21813
|
function compile(src, options) {
|
|
21814
|
+
src = decode(src);
|
|
21751
21815
|
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21752
21816
|
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21753
21817
|
if (threads === 0) {
|
|
@@ -21944,6 +22008,7 @@ var main_civet_default = { parse, parseProgram, ParseError: import_lib2.ParseErr
|
|
|
21944
22008
|
ParseErrors,
|
|
21945
22009
|
SourceMap,
|
|
21946
22010
|
compile,
|
|
22011
|
+
decode,
|
|
21947
22012
|
generate,
|
|
21948
22013
|
isCompileError,
|
|
21949
22014
|
lib,
|
package/dist/main.mjs
CHANGED
|
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
mod
|
|
29
29
|
));
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// ../Hera/dist/machine.js
|
|
32
32
|
var require_machine = __commonJS({
|
|
33
|
-
"
|
|
33
|
+
"../Hera/dist/machine.js"(exports, module) {
|
|
34
34
|
"use strict";
|
|
35
35
|
var __defProp2 = Object.defineProperty;
|
|
36
36
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -4024,7 +4024,11 @@ function processSignature(f) {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
}
|
|
4026
4026
|
if (signature.modifier.async && !signature.modifier.generator && signature.returnType && !isPromiseType(signature.returnType.t)) {
|
|
4027
|
-
replaceNode(
|
|
4027
|
+
replaceNode(
|
|
4028
|
+
signature.returnType.t,
|
|
4029
|
+
wrapTypeInPromise(signature.returnType.t),
|
|
4030
|
+
signature.returnType
|
|
4031
|
+
);
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
4030
4034
|
function processFunctions(statements, config2) {
|
|
@@ -7627,21 +7631,18 @@ function makeExpressionStatement(expression) {
|
|
|
7627
7631
|
}
|
|
7628
7632
|
}
|
|
7629
7633
|
function lastAccessInCallExpression(exp) {
|
|
7630
|
-
|
|
7634
|
+
while (exp.type === "MemberExpression" || exp.type === "CallExpression") {
|
|
7635
|
+
const { children } = exp;
|
|
7636
|
+
let i = children.length - 1;
|
|
7637
|
+
while (i >= 0 && typeof children[i] === "object" && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7638
|
+
if (i < 0) return;
|
|
7639
|
+
exp = children[i];
|
|
7640
|
+
}
|
|
7641
|
+
if (exp.type === "Identifier" || exp.type === "PropertyAccess" || exp.type === "Index") {
|
|
7631
7642
|
return exp;
|
|
7632
7643
|
}
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
if (!(exp.children != null)) {
|
|
7636
|
-
return;
|
|
7637
|
-
}
|
|
7638
|
-
;
|
|
7639
|
-
({ children } = exp);
|
|
7640
|
-
i = children.length - 1;
|
|
7641
|
-
while (i >= 0 && (children[i].type === "Call" || children[i].type === "NonNullAssertion" || children[i].type === "Optional")) i--;
|
|
7642
|
-
if (i < 0) return;
|
|
7643
|
-
} while (children[i].type === "MemberExpression" && (exp = children[i]));
|
|
7644
|
-
return children[i];
|
|
7644
|
+
;
|
|
7645
|
+
return;
|
|
7645
7646
|
}
|
|
7646
7647
|
function convertMethodToFunction(method) {
|
|
7647
7648
|
const { signature, block } = method;
|
|
@@ -12991,7 +12992,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12991
12992
|
var behavior = $2;
|
|
12992
12993
|
var w = $3;
|
|
12993
12994
|
var decl = $4;
|
|
12994
|
-
decl.names.forEach((name) =>
|
|
12995
|
+
decl.names.forEach((name) => setOperatorBehavior(name, behavior));
|
|
12995
12996
|
if (behavior?.error) decl = prepend(behavior.error, decl);
|
|
12996
12997
|
decl = prepend(trimFirstSpace(w), decl);
|
|
12997
12998
|
return decl;
|
|
@@ -12999,7 +13000,7 @@ var OperatorDeclaration$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, (
|
|
|
12999
13000
|
var OperatorDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
13000
13001
|
var signature = $1;
|
|
13001
13002
|
var block = $2;
|
|
13002
|
-
|
|
13003
|
+
setOperatorBehavior(signature.id.name, signature.behavior);
|
|
13003
13004
|
return {
|
|
13004
13005
|
...signature,
|
|
13005
13006
|
type: "FunctionExpression",
|
|
@@ -13016,10 +13017,10 @@ var OperatorDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(Operator, _
|
|
|
13016
13017
|
var behavior = $4;
|
|
13017
13018
|
var ids = $5;
|
|
13018
13019
|
const children = [];
|
|
13019
|
-
|
|
13020
|
+
setOperatorBehavior(id.name, behavior);
|
|
13020
13021
|
if (behavior?.error) children.push(behavior.error);
|
|
13021
13022
|
ids.forEach(([, , id2, behavior2]) => {
|
|
13022
|
-
|
|
13023
|
+
setOperatorBehavior(id2.name, behavior2);
|
|
13023
13024
|
if (behavior2?.error) children.push(behavior2.error);
|
|
13024
13025
|
});
|
|
13025
13026
|
return {
|
|
@@ -16752,7 +16753,7 @@ var ImportDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
|
|
|
16752
16753
|
const errors = [];
|
|
16753
16754
|
if (behavior?.error) errors.push(behavior.error);
|
|
16754
16755
|
imports.specifiers.forEach((spec) => {
|
|
16755
|
-
|
|
16756
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16756
16757
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16757
16758
|
});
|
|
16758
16759
|
return {
|
|
@@ -16803,7 +16804,7 @@ var ImportDeclaration$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, _
|
|
|
16803
16804
|
const errors = [];
|
|
16804
16805
|
if (behavior?.error) errors.push(behavior.error);
|
|
16805
16806
|
imports.specifiers.forEach((spec) => {
|
|
16806
|
-
|
|
16807
|
+
setOperatorBehavior(spec.binding.name, spec.behavior ?? behavior);
|
|
16807
16808
|
if (spec.behavior?.error) errors.push(spec.behavior.error);
|
|
16808
16809
|
});
|
|
16809
16810
|
return {
|
|
@@ -16935,7 +16936,7 @@ var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Oper
|
|
|
16935
16936
|
if (spec.binding.type !== "Identifier") {
|
|
16936
16937
|
throw new Error("Expected identifier after `operator`");
|
|
16937
16938
|
}
|
|
16938
|
-
|
|
16939
|
+
setOperatorBehavior(spec.binding.name, spec.behavior);
|
|
16939
16940
|
return {
|
|
16940
16941
|
...spec,
|
|
16941
16942
|
children: [
|
|
@@ -20531,6 +20532,7 @@ var CivetOption$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R99, "CivetOp
|
|
|
20531
20532
|
break;
|
|
20532
20533
|
case "globals":
|
|
20533
20534
|
case "symbols":
|
|
20535
|
+
case "operators":
|
|
20534
20536
|
value = value.split(",").filter(Boolean);
|
|
20535
20537
|
break;
|
|
20536
20538
|
}
|
|
@@ -20939,6 +20941,36 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
|
|
|
20939
20941
|
}
|
|
20940
20942
|
}
|
|
20941
20943
|
});
|
|
20944
|
+
Object.defineProperty(config, "operators", {
|
|
20945
|
+
set(o) {
|
|
20946
|
+
if (!o) return;
|
|
20947
|
+
if (typeof o !== "object") {
|
|
20948
|
+
throw new Error("operators configuration must be an object or array");
|
|
20949
|
+
}
|
|
20950
|
+
if (Array.isArray(o)) {
|
|
20951
|
+
o.forEach((name) => {
|
|
20952
|
+
if (typeof name !== "string") {
|
|
20953
|
+
throw new Error("operators configuration array must contain only strings");
|
|
20954
|
+
}
|
|
20955
|
+
setOperatorBehavior(name, void 0);
|
|
20956
|
+
});
|
|
20957
|
+
} else {
|
|
20958
|
+
for (let [name, behavior] of Object.entries(o)) {
|
|
20959
|
+
if (typeof behavior === "string") {
|
|
20960
|
+
behavior = behavior.trim();
|
|
20961
|
+
behavior = behavior ? parse(behavior, {
|
|
20962
|
+
startRule: "OperatorBehavior",
|
|
20963
|
+
filename: `operator config for ${name}`
|
|
20964
|
+
}) : void 0;
|
|
20965
|
+
}
|
|
20966
|
+
if (behavior && typeof behavior !== "object") {
|
|
20967
|
+
throw new Error("operators configuration object must have string or object values");
|
|
20968
|
+
}
|
|
20969
|
+
setOperatorBehavior(name, behavior);
|
|
20970
|
+
}
|
|
20971
|
+
}
|
|
20972
|
+
}
|
|
20973
|
+
});
|
|
20942
20974
|
Object.assign(config, initialConfig);
|
|
20943
20975
|
});
|
|
20944
20976
|
function Reset(ctx, state2) {
|
|
@@ -21070,26 +21102,24 @@ var PushExtraIndent1$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pus
|
|
|
21070
21102
|
function PushExtraIndent1(ctx, state2) {
|
|
21071
21103
|
return (0, import_lib2.$EVENT)(ctx, state2, "PushExtraIndent1", PushExtraIndent1$0);
|
|
21072
21104
|
}
|
|
21073
|
-
var parser =
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
};
|
|
21092
|
-
}();
|
|
21105
|
+
var parser = {
|
|
21106
|
+
parse: (input, options = {}) => {
|
|
21107
|
+
const { fail, validate, reset } = (0, import_lib2.Validator)();
|
|
21108
|
+
let ctx = { expectation: "", fail };
|
|
21109
|
+
if (typeof input !== "string") throw new Error("Input must be a string");
|
|
21110
|
+
const parser2 = options.startRule != null ? grammar[options.startRule] : Object.values(grammar)[0];
|
|
21111
|
+
if (!parser2) throw new Error(`Could not find rule with name '${options.startRule}'`);
|
|
21112
|
+
const filename2 = options.filename || "<anonymous>";
|
|
21113
|
+
reset();
|
|
21114
|
+
Object.assign(ctx, { ...options.events, tokenize: options.tokenize });
|
|
21115
|
+
return validate(input, parser2(ctx, {
|
|
21116
|
+
input,
|
|
21117
|
+
pos: 0
|
|
21118
|
+
}), {
|
|
21119
|
+
filename: filename2
|
|
21120
|
+
});
|
|
21121
|
+
}
|
|
21122
|
+
};
|
|
21093
21123
|
var { parse } = parser;
|
|
21094
21124
|
var filename;
|
|
21095
21125
|
var initialConfig;
|
|
@@ -21168,6 +21198,14 @@ Object.defineProperties(state, {
|
|
|
21168
21198
|
}
|
|
21169
21199
|
}
|
|
21170
21200
|
});
|
|
21201
|
+
function setOperatorBehavior(name, behavior) {
|
|
21202
|
+
const existing = state.operators.get(name);
|
|
21203
|
+
if (existing && behavior) {
|
|
21204
|
+
state.operators.set(name, { ...existing, ...behavior });
|
|
21205
|
+
} else {
|
|
21206
|
+
state.operators.set(name, behavior || existing);
|
|
21207
|
+
}
|
|
21208
|
+
}
|
|
21171
21209
|
function getStateKey() {
|
|
21172
21210
|
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
|
|
21173
21211
|
// since it is affected by the directive prologue and may be hit
|
|
@@ -21734,7 +21772,32 @@ var uncacheable = /* @__PURE__ */ new Set([
|
|
|
21734
21772
|
"RestorePipeline"
|
|
21735
21773
|
]);
|
|
21736
21774
|
var workerPool;
|
|
21775
|
+
function decode(src) {
|
|
21776
|
+
if (typeof src === "string") {
|
|
21777
|
+
return src;
|
|
21778
|
+
}
|
|
21779
|
+
if (typeof Buffer === "undefined") {
|
|
21780
|
+
return src;
|
|
21781
|
+
}
|
|
21782
|
+
if (!Buffer?.isBuffer(src)) {
|
|
21783
|
+
return src;
|
|
21784
|
+
}
|
|
21785
|
+
if (src[0] === 239 && src[1] === 187 && src[2] === 191) {
|
|
21786
|
+
return src.toString("utf8", 3);
|
|
21787
|
+
} else if (src[0] === 255 && src[1] === 254) {
|
|
21788
|
+
return src.toString("utf16le", 2);
|
|
21789
|
+
} else if (src[0] === 254 && src[1] === 255) {
|
|
21790
|
+
for (let end = src.length - 2, i1 = 2; i1 <= end; i1 += 2) {
|
|
21791
|
+
const i = i1;
|
|
21792
|
+
[src[i], src[i + 1]] = [src[i + 1], src[i]];
|
|
21793
|
+
}
|
|
21794
|
+
return src.toString("utf16le", 2);
|
|
21795
|
+
} else {
|
|
21796
|
+
return src.toString("utf8");
|
|
21797
|
+
}
|
|
21798
|
+
}
|
|
21737
21799
|
function compile(src, options) {
|
|
21800
|
+
src = decode(src);
|
|
21738
21801
|
if (!(process.env.CIVET_THREADS == 0)) {
|
|
21739
21802
|
const threads = parseInt(options?.threads ?? process.env.CIVET_THREADS, 10);
|
|
21740
21803
|
if (threads === 0) {
|
|
@@ -21931,6 +21994,7 @@ export {
|
|
|
21931
21994
|
ParseErrors,
|
|
21932
21995
|
SourceMap2 as SourceMap,
|
|
21933
21996
|
compile,
|
|
21997
|
+
decode,
|
|
21934
21998
|
main_civet_default as default,
|
|
21935
21999
|
generate_civet_default as generate,
|
|
21936
22000
|
isCompileError,
|
package/dist/types.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ declare module "@danielx/civet" {
|
|
|
26
26
|
implicitReturns: boolean
|
|
27
27
|
jsxCode: boolean
|
|
28
28
|
objectIs: boolean
|
|
29
|
+
/** Array of names to treat as operators, or object mapping names to
|
|
30
|
+
* parsable operator behaviors such as "relational" or "same (+)" or
|
|
31
|
+
* "relational same (+)", or ""/undefined for default behavior.
|
|
32
|
+
* (Can also map to OperatorBehavior as defined in source/types.civet,
|
|
33
|
+
* but the details are subject to change.)
|
|
34
|
+
*/
|
|
35
|
+
operators: string[] | Record<string, string?>
|
|
29
36
|
react: boolean
|
|
30
37
|
solid: boolean
|
|
31
38
|
client: boolean
|
|
@@ -41,25 +48,92 @@ declare module "@danielx/civet" {
|
|
|
41
48
|
repl: boolean
|
|
42
49
|
}>
|
|
43
50
|
export type CompileOptions = {
|
|
51
|
+
/**
|
|
52
|
+
* If your Civet code comes from a file, provide it here. This gets used
|
|
53
|
+
* in sourcemaps and error messages.
|
|
54
|
+
*/
|
|
44
55
|
filename?: string
|
|
56
|
+
/**
|
|
57
|
+
* Whether to return a source map in addition to transpiled code.
|
|
58
|
+
* If false (the default), `compile` just returns transpiled code.
|
|
59
|
+
* If true (and `inlineMap` is false/unspecified),
|
|
60
|
+
* `compile` returns an object `{code, sourceMap}` whose `code` property
|
|
61
|
+
* is transpiled code and `sourceMap` property is a `SourceMap` object.
|
|
62
|
+
*/
|
|
45
63
|
sourceMap?: boolean
|
|
64
|
+
/**
|
|
65
|
+
* Whether to inline a source map as a final comment in the transpiled code.
|
|
66
|
+
* Default is false.
|
|
67
|
+
*/
|
|
46
68
|
inlineMap?: boolean
|
|
69
|
+
/**
|
|
70
|
+
* Whether to return an AST of the parsed code instead of transpiled code.
|
|
71
|
+
* Default is false.
|
|
72
|
+
* If true, `compile` skips the `generate` step that turns the parsed AST
|
|
73
|
+
* into a code string, and just returns the AST itself.
|
|
74
|
+
* If "raw", `compile` also skips the `prune` step, which leaves some
|
|
75
|
+
* extra properties on the AST nodes (e.g. `parent` pointers) and
|
|
76
|
+
* preserves that `children` is always an array.
|
|
77
|
+
*/
|
|
47
78
|
ast?: boolean | "raw"
|
|
79
|
+
/**
|
|
80
|
+
* Whether Civet should convert TypeScript syntax to JavaScript.
|
|
81
|
+
* This mostly triggers the removal of type annotations, but some
|
|
82
|
+
* TypeScript features such as `enum` are also supported.
|
|
83
|
+
* Default is false.
|
|
84
|
+
*/
|
|
48
85
|
js?: boolean
|
|
86
|
+
/**
|
|
87
|
+
* If set to true, turns off the compiler cache of compiled subexpressions.
|
|
88
|
+
* This should not affect the compilation output,
|
|
89
|
+
* and can make the compiler exponentially slow.
|
|
90
|
+
* It is mainly for testing whether there is a bug in the compiler cache.
|
|
91
|
+
*/
|
|
49
92
|
noCache?: boolean
|
|
93
|
+
/**
|
|
94
|
+
* If specified, also writes data about compiler cache performance
|
|
95
|
+
* into the specified filename. Useful for debugging caching performance.
|
|
96
|
+
*/
|
|
50
97
|
hits?: string
|
|
98
|
+
/**
|
|
99
|
+
* If specified, also writes data about all parse branches considered by
|
|
100
|
+
* the compiler into the specified filename.
|
|
101
|
+
* Useful for debugging why something parsed the way it did.
|
|
102
|
+
*/
|
|
51
103
|
trace?: string
|
|
104
|
+
/**
|
|
105
|
+
* Initial parse options, e.g., read from a config file.
|
|
106
|
+
* They can still be overridden in the code by "civet" pragmas.
|
|
107
|
+
*/
|
|
52
108
|
parseOptions?: ParseOptions
|
|
53
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* By default, `compile` will throw a `ParseErrors` containing all
|
|
111
|
+
* `ParseError`s encountered during compilation.
|
|
112
|
+
* If you specify an empty array, `compile` will not throw and instead
|
|
113
|
+
* will add to the array all `ParseError`s encountered.
|
|
114
|
+
*/
|
|
54
115
|
errors?: ParseError[]
|
|
55
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Number of parallel threads to compile with (Node only).
|
|
118
|
+
* Default is to use the environment variable `CIVET_THREADS`, or 0.
|
|
119
|
+
* If nonzero, spawns up to that many worker threads so that multiple
|
|
120
|
+
* calls to `compile` will end up running in parallel.
|
|
121
|
+
* If `CIVET_THREADS` is set to 0, the `threads` option is ignored.
|
|
122
|
+
*/
|
|
56
123
|
threads?: number
|
|
124
|
+
/**
|
|
125
|
+
* If false (the default), runs the compiler asynchronously and returns
|
|
126
|
+
* a Promise (for the transpiled string or `{code, sourceMap}` object).
|
|
127
|
+
* If true, runs the compiler synchronously and returns the result directly.
|
|
128
|
+
* Sync mode disables some features:
|
|
129
|
+
* - parallel computation via `threads`
|
|
130
|
+
* - comptime code can't return promises
|
|
131
|
+
*/
|
|
132
|
+
sync?: boolean
|
|
57
133
|
}
|
|
58
134
|
export type GenerateOptions = Omit<CompileOptions, "sourceMap"> & {
|
|
59
135
|
sourceMap?: undefined | SourceMap
|
|
60
136
|
}
|
|
61
|
-
export type SyncCompileOptions = CompileOptions &
|
|
62
|
-
{ parseOptions?: { comptime?: false } }
|
|
63
137
|
|
|
64
138
|
export type SourceMapping = [number] | [number, number, number, number]
|
|
65
139
|
|
|
@@ -74,7 +148,7 @@ declare module "@danielx/civet" {
|
|
|
74
148
|
}
|
|
75
149
|
|
|
76
150
|
// TODO: Import ParseError class from Hera
|
|
77
|
-
export
|
|
151
|
+
export class ParseError {
|
|
78
152
|
name: "ParseError"
|
|
79
153
|
message: string // filename:line:column header\nbody
|
|
80
154
|
header: string
|
|
@@ -84,7 +158,8 @@ declare module "@danielx/civet" {
|
|
|
84
158
|
column: number | string
|
|
85
159
|
offset: number
|
|
86
160
|
}
|
|
87
|
-
export
|
|
161
|
+
export class ParseErrors {
|
|
162
|
+
constructor(errors: ParseError[])
|
|
88
163
|
name: "ParseErrors"
|
|
89
164
|
message: string
|
|
90
165
|
errors: ParseError[]
|
|
@@ -97,7 +172,7 @@ declare module "@danielx/civet" {
|
|
|
97
172
|
code: string,
|
|
98
173
|
sourceMap: SourceMap,
|
|
99
174
|
} : string
|
|
100
|
-
export function compile<const T extends CompileOptions>(source: string, options?: T):
|
|
175
|
+
export function compile<const T extends CompileOptions>(source: string | Buffer, options?: T):
|
|
101
176
|
T extends { sync: true } ? CompileOutput<T> : Promise<CompileOutput<T>>
|
|
102
177
|
/** Warning: No caching */
|
|
103
178
|
export function parse(source: string, options?: CompileOptions & {startRule?: string}): CivetAST
|
|
@@ -105,6 +180,7 @@ declare module "@danielx/civet" {
|
|
|
105
180
|
export function parseProgram<T extends CompileOptions>(source: string, options?: T):
|
|
106
181
|
T extends { comptime: true } ? Promise<CivetAST> : CivetAST
|
|
107
182
|
export function generate(ast: CivetAST, options?: GenerateOptions): string
|
|
183
|
+
export function decode(source: string | Buffer): string
|
|
108
184
|
|
|
109
185
|
export const lib: {
|
|
110
186
|
gatherRecursive(ast: CivetAST, predicate: (node: CivetAST) => boolean): CivetAST[]
|
|
@@ -117,6 +193,7 @@ declare module "@danielx/civet" {
|
|
|
117
193
|
isCompileError: typeof isCompileError
|
|
118
194
|
parse: typeof parse
|
|
119
195
|
generate: typeof generate
|
|
196
|
+
decode: typeof decode
|
|
120
197
|
SourceMap: typeof SourceMap
|
|
121
198
|
ParseError: typeof ParseError
|
|
122
199
|
ParseErrors: typeof ParseErrors
|
|
@@ -150,9 +227,10 @@ declare module "@danielx/civet/config" {
|
|
|
150
227
|
export function loadConfig(
|
|
151
228
|
path: string
|
|
152
229
|
): Promise<import("@danielx/civet").CompileOptions>
|
|
153
|
-
|
|
154
|
-
findInDir,
|
|
155
|
-
findConfig,
|
|
156
|
-
loadConfig,
|
|
230
|
+
const Config: {
|
|
231
|
+
findInDir: typeof findInDir,
|
|
232
|
+
findConfig: typeof findConfig,
|
|
233
|
+
loadConfig: typeof loadConfig,
|
|
157
234
|
}
|
|
235
|
+
export default Config
|
|
158
236
|
}
|
|
@@ -265,9 +265,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
265
265
|
if (!filename.endsWith(".civet.tsx")) return systemReadFile(filename, encoding);
|
|
266
266
|
if (fsMap.has(filename)) return fsMap.get(filename);
|
|
267
267
|
const civetFilename = filename.slice(0, -4);
|
|
268
|
-
const rawCivetSource = fs.readFileSync(civetFilename, {
|
|
269
|
-
encoding
|
|
270
|
-
});
|
|
268
|
+
const rawCivetSource = fs.readFileSync(civetFilename, { encoding });
|
|
271
269
|
const { code: compiledTS, sourceMap } = import_civet.default.compile(rawCivetSource, {
|
|
272
270
|
...tsCompileOptions,
|
|
273
271
|
filename,
|
|
@@ -465,7 +463,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
465
463
|
filename: id,
|
|
466
464
|
errors: []
|
|
467
465
|
};
|
|
468
|
-
const rawCivetSource = await fs.promises.readFile(filename
|
|
466
|
+
const rawCivetSource = (0, import_civet.decode)(await fs.promises.readFile(filename));
|
|
469
467
|
const ast = await import_civet.default.compile(rawCivetSource, {
|
|
470
468
|
...civetOptions,
|
|
471
469
|
ast: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
|
-
import civet, { lib, SourceMap } from "@danielx/civet";
|
|
3
|
+
import civet, { decode, lib, SourceMap } from "@danielx/civet";
|
|
4
4
|
import { findInDir, loadConfig } from "@danielx/civet/config";
|
|
5
5
|
import {
|
|
6
6
|
remapRange,
|
|
@@ -233,9 +233,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
233
233
|
if (!filename.endsWith(".civet.tsx")) return systemReadFile(filename, encoding);
|
|
234
234
|
if (fsMap.has(filename)) return fsMap.get(filename);
|
|
235
235
|
const civetFilename = filename.slice(0, -4);
|
|
236
|
-
const rawCivetSource = fs.readFileSync(civetFilename, {
|
|
237
|
-
encoding
|
|
238
|
-
});
|
|
236
|
+
const rawCivetSource = fs.readFileSync(civetFilename, { encoding });
|
|
239
237
|
const { code: compiledTS, sourceMap } = civet.compile(rawCivetSource, {
|
|
240
238
|
...tsCompileOptions,
|
|
241
239
|
filename,
|
|
@@ -433,7 +431,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
433
431
|
filename: id,
|
|
434
432
|
errors: []
|
|
435
433
|
};
|
|
436
|
-
const rawCivetSource = await fs.promises.readFile(filename
|
|
434
|
+
const rawCivetSource = decode(await fs.promises.readFile(filename));
|
|
437
435
|
const ast = await civet.compile(rawCivetSource, {
|
|
438
436
|
...civetOptions,
|
|
439
437
|
ast: true
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.7",
|
|
5
5
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.mjs",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@danielx/civet": "0.9.4",
|
|
115
|
-
"@danielx/hera": "^0.8.
|
|
115
|
+
"@danielx/hera": "^0.8.17",
|
|
116
116
|
"@prettier/sync": "^0.5.2",
|
|
117
117
|
"@types/assert": "^1.5.6",
|
|
118
118
|
"@types/mocha": "^10.0.8",
|
package/register.js
CHANGED
|
@@ -58,7 +58,7 @@ const { compile } = require("./");
|
|
|
58
58
|
// Old-style CJS registration
|
|
59
59
|
if (require.extensions) {
|
|
60
60
|
require.extensions[".civet"] = function (module, filename) {
|
|
61
|
-
const js = compile(fs.readFileSync(filename
|
|
61
|
+
const js = compile(fs.readFileSync(filename), {
|
|
62
62
|
filename,
|
|
63
63
|
js: true,
|
|
64
64
|
inlineMap: true,
|
|
@@ -83,7 +83,7 @@ function retrieveFile(path) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (!outputCache.has(path)) {
|
|
86
|
-
outputCache.set(path, compile(fs.readFileSync(path
|
|
86
|
+
outputCache.set(path, compile(fs.readFileSync(path), {
|
|
87
87
|
filename: path,
|
|
88
88
|
js: true,
|
|
89
89
|
inlineMap: true,
|