@danielx/civet 0.11.2 → 0.11.3
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 +16 -0
- package/README.md +3 -0
- package/dist/browser.js +164 -53
- package/dist/civet +91 -35
- package/dist/config.js +3 -0
- package/dist/config.mjs +3 -0
- package/dist/main.js +217 -62
- package/dist/main.mjs +217 -62
- package/dist/unplugin/unplugin.js +176 -3
- package/dist/unplugin/unplugin.mjs +183 -3
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ 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.11.3 (2026-02-25, [diff](https://github.com/DanielXMoore/Civet/compare/v0.11.2...v0.11.3), [commits](https://github.com/DanielXMoore/Civet/commits/v0.11.3))
|
|
8
|
+
* Fix REPL continuation prompt to `...`, clarifying indentation [[#1843](https://github.com/DanielXMoore/Civet/pull/1843)]
|
|
9
|
+
* Don't treat `package.js/civet` as config [[#1844](https://github.com/DanielXMoore/Civet/pull/1844)]
|
|
10
|
+
* BREAKING CHANGE: Civet can no longer be configured from a default export of `package.js` or `package.civet`
|
|
11
|
+
* Make typescript an optional peer dep, bundle @typescript/vfs [[#1842](https://github.com/DanielXMoore/Civet/pull/1842)]
|
|
12
|
+
* Tests for CLI output filename generation [[#1847](https://github.com/DanielXMoore/Civet/pull/1847)]
|
|
13
|
+
* `>` closes type arguments; forbid binary `x> y` [[#1848](https://github.com/DanielXMoore/Civet/pull/1848)]
|
|
14
|
+
* BREAKING CHANGE: `x> y` no longer compares; use `x>y` or `x > y`
|
|
15
|
+
* LSP: ensure immediate updates for opened dependent files on change [[#1779](https://github.com/DanielXMoore/Civet/pull/1779)]
|
|
16
|
+
* Spreads and multiple items in parenthesized postfix loops, postfixes in declarations [[#1849](https://github.com/DanielXMoore/Civet/pull/1849)]
|
|
17
|
+
* Syntax highlighting for import/export shorthands and `for` keywords [[#1580](https://github.com/DanielXMoore/Civet/pull/1580)]
|
|
18
|
+
* Implicit `async`, `AutoPromise`, `function*` propagate to overloads [[#1852](https://github.com/DanielXMoore/Civet/pull/1852)]
|
|
19
|
+
* Postfix support in parenthesized or indented function arguments [[#1853](https://github.com/DanielXMoore/Civet/pull/1853)]
|
|
20
|
+
* BREAKING CHANGE: Function application with a postfix on the last indented argument now applies the postfix to the argument, not the whole function application.
|
|
21
|
+
* Website playground: tab key insert tabs or indents, escape key defocuses [[#1626](https://github.com/DanielXMoore/Civet/pull/1626)]
|
|
22
|
+
|
|
7
23
|
## 0.11.2 (2026-01-21, [diff](https://github.com/DanielXMoore/Civet/compare/v0.11.1...v0.11.2), [commits](https://github.com/DanielXMoore/Civet/commits/v0.11.2))
|
|
8
24
|
* VSCode extension supports rename-symbol [[#1823](https://github.com/DanielXMoore/Civet/pull/1823)]
|
|
9
25
|
* Fix scoping of unwrapped statement expressions [[#1833](https://github.com/DanielXMoore/Civet/pull/1833)]
|
package/README.md
CHANGED
|
@@ -46,6 +46,9 @@ civet < source.civet > output.ts
|
|
|
46
46
|
civet source.civet ...args...
|
|
47
47
|
# Execute a .civet source file in node
|
|
48
48
|
node --import @danielx/civet/register source.civet
|
|
49
|
+
# Type check entire project, which requires TypeScript installed
|
|
50
|
+
npm install -g typescript
|
|
51
|
+
civet --typecheck
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|

|
package/dist/browser.js
CHANGED
|
@@ -2328,17 +2328,49 @@ ${js}`
|
|
|
2328
2328
|
};
|
|
2329
2329
|
}
|
|
2330
2330
|
function implicitFunctionBlock(f) {
|
|
2331
|
-
if (f.abstract || f.block || f.signature?.optional)
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2331
|
+
if (!(f.abstract || f.block || f.signature?.optional))
|
|
2332
|
+
if (followingOverloads(f).length)
|
|
2333
|
+
f.ts = !0;
|
|
2334
|
+
else {
|
|
2335
|
+
let block = makeEmptyBlock();
|
|
2336
|
+
block.parent = f, f.block = block, f.children.push(block), f.ts = !1;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
function overloadsInDirection(f, direction) {
|
|
2340
|
+
if (f.name == null)
|
|
2341
|
+
return [];
|
|
2342
|
+
let ancestor = f.parent, child = f;
|
|
2343
|
+
if (ancestor?.type === "ExportDeclaration" && (child = ancestor, ancestor = ancestor.parent), ancestor?.type !== "BlockStatement")
|
|
2344
|
+
return [];
|
|
2345
|
+
let { expressions } = ancestor, index = findChildIndex(expressions, child);
|
|
2346
|
+
if (!(index >= 0))
|
|
2347
|
+
return [];
|
|
2348
|
+
if (direction < 0) {
|
|
2349
|
+
let results1 = [];
|
|
2350
|
+
for (; --index >= 0; ) {
|
|
2351
|
+
let candidate = expressions[index][1];
|
|
2352
|
+
if (!candidate || (candidate.type === "ExportDeclaration" && (candidate = candidate.declaration), !(candidate && candidate.type === f.type && candidate.name === f.name)))
|
|
2353
|
+
break;
|
|
2354
|
+
results1.push(candidate);
|
|
2355
|
+
}
|
|
2356
|
+
return results1;
|
|
2357
|
+
} else {
|
|
2358
|
+
let results2 = [];
|
|
2359
|
+
for (; ++index < expressions.length; ) {
|
|
2360
|
+
let candidate = expressions[index][1];
|
|
2361
|
+
if (!candidate || (candidate.type === "ExportDeclaration" && (candidate = candidate.declaration), !(candidate && candidate.type === f.type && candidate.name === f.name)))
|
|
2362
|
+
break;
|
|
2363
|
+
results2.push(candidate);
|
|
2364
|
+
}
|
|
2365
|
+
return results2;
|
|
2340
2366
|
}
|
|
2341
2367
|
}
|
|
2368
|
+
function precedingOverloads(f) {
|
|
2369
|
+
return overloadsInDirection(f, -1);
|
|
2370
|
+
}
|
|
2371
|
+
function followingOverloads(f) {
|
|
2372
|
+
return overloadsInDirection(f, 1);
|
|
2373
|
+
}
|
|
2342
2374
|
function processReturn(f, implicitReturns) {
|
|
2343
2375
|
let { returnType } = f.signature;
|
|
2344
2376
|
if (returnType && returnType.optional && convertOptionalType(returnType), !processReturnValue(f) && (implicitReturns || f.signature.implicitReturn)) {
|
|
@@ -3076,10 +3108,7 @@ ${js}`
|
|
|
3076
3108
|
let { ancestor } = findAncestor(f, ($10) => $10.type === "ClassExpression");
|
|
3077
3109
|
if (ancestor != null) {
|
|
3078
3110
|
let fields = new Set(gatherRecursiveWithinFunction(ancestor, ($11) => $11.type === "FieldDefinition").map(($12) => $12.id).filter((a3) => typeof a3 == "object" && a3 != null && "type" in a3 && a3.type === "Identifier").map(($13) => $13.name)), classExpressions = ancestor.body.expressions, index2 = findChildIndex(classExpressions, f);
|
|
3079
|
-
assert.notEqual(index2, -1, "Could not find constructor in class");
|
|
3080
|
-
let m7;
|
|
3081
|
-
for (; m7 = classExpressions[index2 - 1]?.[1], typeof m7 == "object" && m7 != null && "type" in m7 && m7.type === "MethodDefinition" && "name" in m7 && m7.name === "constructor"; )
|
|
3082
|
-
index2--;
|
|
3111
|
+
assert.notEqual(index2, -1, "Could not find constructor in class"), index2 -= precedingOverloads(f).length;
|
|
3083
3112
|
let fStatement = classExpressions[index2];
|
|
3084
3113
|
for (let ref20 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
|
|
3085
3114
|
let parameter = ref20[i10], { accessModifier } = parameter;
|
|
@@ -3145,10 +3174,10 @@ ${js}`
|
|
|
3145
3174
|
return -1;
|
|
3146
3175
|
}
|
|
3147
3176
|
function processSignature(f) {
|
|
3148
|
-
let { block, signature } = f;
|
|
3177
|
+
let { block, signature } = f, addAsync = !1, addGenerator = !1;
|
|
3149
3178
|
if (!f.async?.length && hasAwait(block))
|
|
3150
3179
|
if (f.async != null)
|
|
3151
|
-
|
|
3180
|
+
addAsync = !0;
|
|
3152
3181
|
else
|
|
3153
3182
|
for (let ref23 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref23.length; i13 < len12; i13++) {
|
|
3154
3183
|
let a = ref23[i13], i = findChildIndex(a.parent, a);
|
|
@@ -3159,7 +3188,7 @@ ${js}`
|
|
|
3159
3188
|
}
|
|
3160
3189
|
if (!f.generator?.length && hasYield(block))
|
|
3161
3190
|
if (f.generator != null)
|
|
3162
|
-
|
|
3191
|
+
addGenerator = !0;
|
|
3163
3192
|
else
|
|
3164
3193
|
for (let ref24 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref24.length; i14 < len13; i14++) {
|
|
3165
3194
|
let y = ref24[i14], i = y.children.findIndex(($19) => $19.type === "Yield");
|
|
@@ -3168,15 +3197,18 @@ ${js}`
|
|
|
3168
3197
|
message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
3169
3198
|
});
|
|
3170
3199
|
}
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3200
|
+
for (let ref25 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
|
|
3201
|
+
let overload = ref25[i15];
|
|
3202
|
+
addAsync && overload.async != null && !overload.async.length && (overload.async.push("async "), overload.signature.modifier.async = !0), addGenerator && overload.generator != null && !overload.generator.length && (overload.generator.push("*"), overload.signature.modifier.generator = !0), overload.signature.modifier.async && !overload.signature.modifier.generator && overload.signature.returnType && !isPromiseType(overload.signature.returnType.t) && replaceNode(
|
|
3203
|
+
overload.signature.returnType.t,
|
|
3204
|
+
wrapTypeInPromise(overload.signature.returnType.t),
|
|
3205
|
+
overload.signature.returnType
|
|
3206
|
+
);
|
|
3207
|
+
}
|
|
3176
3208
|
}
|
|
3177
3209
|
function processFunctions(statements, config2) {
|
|
3178
|
-
for (let
|
|
3179
|
-
let f =
|
|
3210
|
+
for (let ref26 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref26.length; i16 < len15; i16++) {
|
|
3211
|
+
let f = ref26[i16];
|
|
3180
3212
|
(f.type === "FunctionExpression" || f.type === "MethodDefinition") && implicitFunctionBlock(f), processSignature(f), processParams(f), processReturn(f, config2.implicitReturns);
|
|
3181
3213
|
}
|
|
3182
3214
|
}
|
|
@@ -3223,17 +3255,17 @@ ${js}`
|
|
|
3223
3255
|
}
|
|
3224
3256
|
let done;
|
|
3225
3257
|
if (!async) {
|
|
3226
|
-
let
|
|
3227
|
-
if ((
|
|
3228
|
-
let { block: parentBlock, index } =
|
|
3258
|
+
let ref27;
|
|
3259
|
+
if ((ref27 = blockContainingStatement(exp)) && typeof ref27 == "object" && "block" in ref27 && "index" in ref27) {
|
|
3260
|
+
let { block: parentBlock, index } = ref27;
|
|
3229
3261
|
statements[0][0] = parentBlock.expressions[index][0], parentBlock.expressions.splice(index, index + 1 - index, ...statements), updateParentPointers(parentBlock), braceBlock(parentBlock), done = !0;
|
|
3230
3262
|
}
|
|
3231
3263
|
}
|
|
3232
3264
|
done || (generator || (statements[statements.length - 1][1] = wrapWithReturn(statements[statements.length - 1][1])), children.splice(i, 1, wrapIIFE(statements, async, generator)), updateParentPointers(exp));
|
|
3233
3265
|
}
|
|
3234
3266
|
function processIterationExpressions(statements) {
|
|
3235
|
-
for (let
|
|
3236
|
-
let s =
|
|
3267
|
+
for (let ref28 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref28.length; i17 < len16; i17++) {
|
|
3268
|
+
let s = ref28[i17];
|
|
3237
3269
|
expressionizeIteration(s);
|
|
3238
3270
|
}
|
|
3239
3271
|
}
|
|
@@ -3248,13 +3280,13 @@ ${js}`
|
|
|
3248
3280
|
ws = trimFirstSpace(ws);
|
|
3249
3281
|
let args = [];
|
|
3250
3282
|
if (typeof expression == "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression == "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
|
|
3251
|
-
let { parameters } = expression, parameterList = parameters.parameters,
|
|
3252
|
-
for (let
|
|
3253
|
-
let parameter = parameterList[
|
|
3283
|
+
let { parameters } = expression, parameterList = parameters.parameters, results3 = [];
|
|
3284
|
+
for (let i18 = 0, len17 = parameterList.length; i18 < len17; i18++) {
|
|
3285
|
+
let parameter = parameterList[i18];
|
|
3254
3286
|
if (typeof parameter == "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3255
|
-
let
|
|
3256
|
-
if (
|
|
3257
|
-
let initializer =
|
|
3287
|
+
let ref29;
|
|
3288
|
+
if (ref29 = parameter.initializer) {
|
|
3289
|
+
let initializer = ref29;
|
|
3258
3290
|
args.push(initializer.expression, parameter.delim), parameter = {
|
|
3259
3291
|
...parameter,
|
|
3260
3292
|
initializer: void 0,
|
|
@@ -3265,9 +3297,9 @@ ${js}`
|
|
|
3265
3297
|
(a7) => a7 !== parameter.typeSuffix
|
|
3266
3298
|
));
|
|
3267
3299
|
}
|
|
3268
|
-
|
|
3300
|
+
results3.push(parameter);
|
|
3269
3301
|
}
|
|
3270
|
-
let newParameterList =
|
|
3302
|
+
let newParameterList = results3, newParameters = {
|
|
3271
3303
|
...parameters,
|
|
3272
3304
|
parameters: newParameterList,
|
|
3273
3305
|
children: parameters.children.map(($22) => $22 === parameterList ? newParameterList : $22)
|
|
@@ -6734,12 +6766,16 @@ ${js}`
|
|
|
6734
6766
|
CommaDelimiter,
|
|
6735
6767
|
OptionalCommaDelimiter,
|
|
6736
6768
|
ArgumentList,
|
|
6769
|
+
PostfixedArgumentList,
|
|
6737
6770
|
NestedArguments,
|
|
6738
6771
|
NestedArgumentList,
|
|
6739
6772
|
NestedArgument,
|
|
6740
6773
|
SingleLineArgumentExpressions,
|
|
6741
6774
|
WArgumentPart,
|
|
6775
|
+
SingleLinePostfixedArgumentExpressions,
|
|
6776
|
+
WPostfixedArgumentPart,
|
|
6742
6777
|
ArgumentPart,
|
|
6778
|
+
PostfixedArgumentPart,
|
|
6743
6779
|
BinaryOpExpression,
|
|
6744
6780
|
BinaryOpNotDedented,
|
|
6745
6781
|
BinaryOpRHS,
|
|
@@ -7122,6 +7158,7 @@ ${js}`
|
|
|
7122
7158
|
Debugger,
|
|
7123
7159
|
MaybeNestedNonPipelineExpression,
|
|
7124
7160
|
MaybeNestedPostfixedExpression,
|
|
7161
|
+
MaybeNestedPostfixedCommaExpression,
|
|
7125
7162
|
NestedPostfixedExpressionNoTrailing,
|
|
7126
7163
|
MaybeNestedExpression,
|
|
7127
7164
|
MaybeParenNestedExpression,
|
|
@@ -7729,7 +7766,7 @@ ${js}`
|
|
|
7729
7766
|
function ImplicitArguments(ctx, state2) {
|
|
7730
7767
|
return (0, import_lib2.$EVENT)(ctx, state2, "ImplicitArguments", ImplicitArguments$0);
|
|
7731
7768
|
}
|
|
7732
|
-
var ExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(
|
|
7769
|
+
var ExplicitArguments$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(PostfixedArgumentList, (0, import_lib2.$E)((0, import_lib2.$S)(__, Comma)))), __, RestoreAll, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
7733
7770
|
var open = $1, args = $3, ws = $4, close = $6;
|
|
7734
7771
|
return args ? args[1] ? args = [...args[0], args[1]] : args = args[0] : args = [], {
|
|
7735
7772
|
type: "Call",
|
|
@@ -7828,6 +7865,31 @@ ${js}`
|
|
|
7828
7865
|
function ArgumentList(ctx, state2) {
|
|
7829
7866
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
|
|
7830
7867
|
}
|
|
7868
|
+
var PostfixedArgumentList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), PostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$N)(EOS), (0, import_lib2.$E)(_), PostfixedArgumentPart)), (0, import_lib2.$S)(CommaDelimiter, NestedArguments), (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
7869
|
+
return [
|
|
7870
|
+
$2,
|
|
7871
|
+
...$3.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
|
|
7872
|
+
...Array.isArray($4[1]) ? [$4[0], ...$4[1]] : $4,
|
|
7873
|
+
...$5.flatMap(
|
|
7874
|
+
([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
|
|
7875
|
+
)
|
|
7876
|
+
];
|
|
7877
|
+
}), PostfixedArgumentList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(NestedArguments, (0, import_lib2.$Q)((0, import_lib2.$S)(OptionalCommaDelimiter, NestedArguments))), function($skip, $loc, $0, $1, $2) {
|
|
7878
|
+
return Array.isArray($1) || ($1 = [$1]), [
|
|
7879
|
+
...trimFirstSpace($1),
|
|
7880
|
+
...$2.flatMap(
|
|
7881
|
+
([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
|
|
7882
|
+
)
|
|
7883
|
+
];
|
|
7884
|
+
}), PostfixedArgumentList$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)(CommaDelimiter, (0, import_lib2.$E)(_), PostfixedArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
7885
|
+
return [
|
|
7886
|
+
prepend($1, $2),
|
|
7887
|
+
...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
|
|
7888
|
+
];
|
|
7889
|
+
}), PostfixedArgumentList$$ = [PostfixedArgumentList$0, PostfixedArgumentList$1, PostfixedArgumentList$2];
|
|
7890
|
+
function PostfixedArgumentList(ctx, state2) {
|
|
7891
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedArgumentList", PostfixedArgumentList$$);
|
|
7892
|
+
}
|
|
7831
7893
|
var NestedArguments$0 = NestedBulletedArray, NestedArguments$1 = NestedImplicitObjectLiteral, NestedArguments$2 = NestedArgumentList, NestedArguments$$ = [NestedArguments$0, NestedArguments$1, NestedArguments$2];
|
|
7832
7894
|
function NestedArguments(ctx, state2) {
|
|
7833
7895
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "NestedArguments", NestedArguments$$);
|
|
@@ -7839,7 +7901,7 @@ ${js}`
|
|
|
7839
7901
|
function NestedArgumentList(ctx, state2) {
|
|
7840
7902
|
return (0, import_lib2.$EVENT)(ctx, state2, "NestedArgumentList", NestedArgumentList$0);
|
|
7841
7903
|
}
|
|
7842
|
-
var NestedArgument$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedImplicitPropertyDefinition), Nested, (0, import_lib2.$N)(Bullet),
|
|
7904
|
+
var NestedArgument$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedImplicitPropertyDefinition), Nested, (0, import_lib2.$N)(Bullet), SingleLinePostfixedArgumentExpressions, ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
7843
7905
|
var indent = $2, args = $4, comma = $5;
|
|
7844
7906
|
let [arg0, ...rest] = args;
|
|
7845
7907
|
return arg0 = prepend(indent, arg0), [arg0, ...rest, comma];
|
|
@@ -7859,6 +7921,18 @@ ${js}`
|
|
|
7859
7921
|
function WArgumentPart(ctx, state2) {
|
|
7860
7922
|
return (0, import_lib2.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
|
|
7861
7923
|
}
|
|
7924
|
+
var SingleLinePostfixedArgumentExpressions$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(WPostfixedArgumentPart, (0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), Comma), WPostfixedArgumentPart))), function($skip, $loc, $0, $1, $2) {
|
|
7925
|
+
return [$1, ...$2.flat()];
|
|
7926
|
+
});
|
|
7927
|
+
function SingleLinePostfixedArgumentExpressions(ctx, state2) {
|
|
7928
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "SingleLinePostfixedArgumentExpressions", SingleLinePostfixedArgumentExpressions$0);
|
|
7929
|
+
}
|
|
7930
|
+
var WPostfixedArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixedArgumentPart), function($skip, $loc, $0, $1, $2) {
|
|
7931
|
+
return prepend($1, $2);
|
|
7932
|
+
});
|
|
7933
|
+
function WPostfixedArgumentPart(ctx, state2) {
|
|
7934
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "WPostfixedArgumentPart", WPostfixedArgumentPart$0);
|
|
7935
|
+
}
|
|
7862
7936
|
var ArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(DotDotDot, Expression), function($skip, $loc, $0, $1, $2) {
|
|
7863
7937
|
var spread = $1, expression = $2;
|
|
7864
7938
|
return {
|
|
@@ -7879,6 +7953,26 @@ ${js}`
|
|
|
7879
7953
|
function ArgumentPart(ctx, state2) {
|
|
7880
7954
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
|
|
7881
7955
|
}
|
|
7956
|
+
var PostfixedArgumentPart$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(DotDotDot, PostfixedExpression), function($skip, $loc, $0, $1, $2) {
|
|
7957
|
+
var spread = $1, expression = $2;
|
|
7958
|
+
return {
|
|
7959
|
+
type: "Argument",
|
|
7960
|
+
children: $0,
|
|
7961
|
+
expression,
|
|
7962
|
+
spread
|
|
7963
|
+
};
|
|
7964
|
+
}), PostfixedArgumentPart$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PostfixedExpression, (0, import_lib2.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
7965
|
+
var expression = $1, spread = $2;
|
|
7966
|
+
return {
|
|
7967
|
+
type: "Argument",
|
|
7968
|
+
children: spread ? [spread, expression] : [expression],
|
|
7969
|
+
expression,
|
|
7970
|
+
spread
|
|
7971
|
+
};
|
|
7972
|
+
}), PostfixedArgumentPart$$ = [PostfixedArgumentPart$0, PostfixedArgumentPart$1];
|
|
7973
|
+
function PostfixedArgumentPart(ctx, state2) {
|
|
7974
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedArgumentPart", PostfixedArgumentPart$$);
|
|
7975
|
+
}
|
|
7882
7976
|
var BinaryOpExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnaryExpression, (0, import_lib2.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
|
|
7883
7977
|
return $2.length ? processBinaryOpExpression($0) : $1;
|
|
7884
7978
|
});
|
|
@@ -7901,9 +7995,10 @@ ${js}`
|
|
|
7901
7995
|
return [[], op, [], rhs];
|
|
7902
7996
|
}), BinaryOpRHS$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(NewlineBinaryOpAllowed, NotDedentedBinaryOp, WRHS), function($skip, $loc, $0, $1, $2, $3) {
|
|
7903
7997
|
var op = $2, rhs = $3;
|
|
7904
|
-
return [...op, ...rhs];
|
|
7905
|
-
}), BinaryOpRHS$3 = (0, import_lib2.$
|
|
7906
|
-
|
|
7998
|
+
return op[1].token === ">" && op[0].length === 0 ? $skip : [...op, ...rhs];
|
|
7999
|
+
}), BinaryOpRHS$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function($skip, $loc, $0, $1, $2) {
|
|
8000
|
+
let [ws1, op] = $2;
|
|
8001
|
+
return op.token === ">" && !ws1.length ? $skip : $2;
|
|
7907
8002
|
}), BinaryOpRHS$$ = [BinaryOpRHS$0, BinaryOpRHS$1, BinaryOpRHS$2, BinaryOpRHS$3];
|
|
7908
8003
|
function BinaryOpRHS(ctx, state2) {
|
|
7909
8004
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "BinaryOpRHS", BinaryOpRHS$$);
|
|
@@ -8627,7 +8722,7 @@ ${js}`
|
|
|
8627
8722
|
children: [id, " = ", exp]
|
|
8628
8723
|
};
|
|
8629
8724
|
}
|
|
8630
|
-
}), FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly, ClassElementName, (0, import_lib2.$E)(TypeSuffix), __, ConstAssignment,
|
|
8725
|
+
}), FieldDefinition$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertReadonly, ClassElementName, (0, import_lib2.$E)(TypeSuffix), __, ConstAssignment, MaybeNestedPostfixedCommaExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
8631
8726
|
var readonly = $1, id = $2, typeSuffix = $3, ca = $5;
|
|
8632
8727
|
return readonly.children[0].$loc = {
|
|
8633
8728
|
pos: ca.$loc.pos - 1,
|
|
@@ -11478,19 +11573,25 @@ ${js}`
|
|
|
11478
11573
|
function PostfixedNoCommaStatement(ctx, state2) {
|
|
11479
11574
|
return (0, import_lib2.$EVENT)(ctx, state2, "PostfixedNoCommaStatement", PostfixedNoCommaStatement$0);
|
|
11480
11575
|
}
|
|
11481
|
-
var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
11576
|
+
var PostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(AssignmentExpressionSpread, (0, import_lib2.$E)(_), (0, import_lib2.$N)(IfClause), PostfixStatement), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11577
|
+
var expression = $1, ws = $2, post = $4;
|
|
11578
|
+
return attachPostfixStatementAsExpression(expression, [ws, post]);
|
|
11579
|
+
}), PostfixedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement)), function($skip, $loc, $0, $1, $2) {
|
|
11482
11580
|
var expression = $1, post = $2;
|
|
11483
|
-
return
|
|
11484
|
-
});
|
|
11581
|
+
return attachPostfixStatementAsExpression(expression, post);
|
|
11582
|
+
}), PostfixedExpression$2 = Expression, PostfixedExpression$$ = [PostfixedExpression$0, PostfixedExpression$1, PostfixedExpression$2];
|
|
11485
11583
|
function PostfixedExpression(ctx, state2) {
|
|
11486
|
-
return (0, import_lib2.$
|
|
11584
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedExpression", PostfixedExpression$$);
|
|
11487
11585
|
}
|
|
11488
|
-
var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
|
|
11586
|
+
var PostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(CommaExpressionSpread, (0, import_lib2.$E)(_), (0, import_lib2.$N)(IfClause), PostfixStatement), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11587
|
+
var expression = $1, ws = $2, post = $4;
|
|
11588
|
+
return attachPostfixStatementAsExpression(expression, [ws, post]);
|
|
11589
|
+
}), PostfixedCommaExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Expression, (0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement)), function($skip, $loc, $0, $1, $2) {
|
|
11489
11590
|
var expression = $1, post = $2;
|
|
11490
|
-
return
|
|
11491
|
-
});
|
|
11591
|
+
return attachPostfixStatementAsExpression(expression, post);
|
|
11592
|
+
}), PostfixedCommaExpression$2 = CommaExpression, PostfixedCommaExpression$$ = [PostfixedCommaExpression$0, PostfixedCommaExpression$1, PostfixedCommaExpression$2];
|
|
11492
11593
|
function PostfixedCommaExpression(ctx, state2) {
|
|
11493
|
-
return (0, import_lib2.$
|
|
11594
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "PostfixedCommaExpression", PostfixedCommaExpression$$);
|
|
11494
11595
|
}
|
|
11495
11596
|
var PostfixStatement$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R31, "PostfixStatement /(?=for|if|loop|unless|until|while)/"), _PostfixStatement), function(value) {
|
|
11496
11597
|
return value[1];
|
|
@@ -12641,6 +12742,16 @@ ${js}`
|
|
|
12641
12742
|
function MaybeNestedPostfixedExpression(ctx, state2) {
|
|
12642
12743
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
|
|
12643
12744
|
}
|
|
12745
|
+
var MaybeNestedPostfixedCommaExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NestedBulletedArray), (0, import_lib2.$N)(NestedImplicitObjectLiteral), PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedCommaExpression)), PopIndent, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12746
|
+
var expression = $4, trailing = $6;
|
|
12747
|
+
return expression ? trailing ? [expression, trailing] : expression : $skip;
|
|
12748
|
+
}), MaybeNestedPostfixedCommaExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(PostfixedCommaExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
|
|
12749
|
+
var expression = $2;
|
|
12750
|
+
return expression || $skip;
|
|
12751
|
+
}), MaybeNestedPostfixedCommaExpression$$ = [MaybeNestedPostfixedCommaExpression$0, MaybeNestedPostfixedCommaExpression$1];
|
|
12752
|
+
function MaybeNestedPostfixedCommaExpression(ctx, state2) {
|
|
12753
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedCommaExpression", MaybeNestedPostfixedCommaExpression$$);
|
|
12754
|
+
}
|
|
12644
12755
|
var NestedPostfixedExpressionNoTrailing$0 = NestedBulletedArray, NestedPostfixedExpressionNoTrailing$1 = NestedImplicitObjectLiteral, NestedPostfixedExpressionNoTrailing$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, PostfixedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
12645
12756
|
var expression = $2;
|
|
12646
12757
|
return expression || $skip;
|
|
@@ -12980,7 +13091,7 @@ ${js}`
|
|
|
12980
13091
|
children: [...$0.slice(0, -2), id]
|
|
12981
13092
|
}
|
|
12982
13093
|
];
|
|
12983
|
-
}), ExportDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), Export, __, Default, __, (0, import_lib2.$C)(HoistableDeclaration, ClassDeclaration, InterfaceDeclaration,
|
|
13094
|
+
}), ExportDeclaration$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), Export, __, Default, __, (0, import_lib2.$C)(HoistableDeclaration, ClassDeclaration, InterfaceDeclaration, MaybeNestedPostfixedExpression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
12984
13095
|
var declaration = $6;
|
|
12985
13096
|
return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
|
|
12986
13097
|
}), ExportDeclaration$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
@@ -13070,7 +13181,7 @@ ${js}`
|
|
|
13070
13181
|
splices: bindings.flatMap((b) => b.splices),
|
|
13071
13182
|
thisAssignments: bindings.flatMap((b) => b.thisAssignments)
|
|
13072
13183
|
};
|
|
13073
|
-
}), LexicalDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import_lib2.$C)(BindingPattern, BindingIdentifier), (0, import_lib2.$E)(TypeSuffix), __, (0, import_lib2.$C)(ConstAssignment, LetAssignment),
|
|
13184
|
+
}), LexicalDeclaration$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, (0, import_lib2.$C)(BindingPattern, BindingIdentifier), (0, import_lib2.$E)(TypeSuffix), __, (0, import_lib2.$C)(ConstAssignment, LetAssignment), MaybeNestedPostfixedCommaExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
13074
13185
|
var loc = $1, assign = $5;
|
|
13075
13186
|
return processAssignmentDeclaration(
|
|
13076
13187
|
{ $loc: loc, token: assign.decl },
|
|
@@ -13127,7 +13238,7 @@ ${js}`
|
|
|
13127
13238
|
function LexicalBinding(ctx, state2) {
|
|
13128
13239
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "LexicalBinding", LexicalBinding$$);
|
|
13129
13240
|
}
|
|
13130
|
-
var Initializer$0 = (0, import_lib2.$T)((0, import_lib2.$S)(__, Equals,
|
|
13241
|
+
var Initializer$0 = (0, import_lib2.$T)((0, import_lib2.$S)(__, Equals, MaybeNestedPostfixedExpression), function(value) {
|
|
13131
13242
|
var expression = value[2];
|
|
13132
13243
|
return { type: "Initializer", expression, children: value };
|
|
13133
13244
|
});
|
package/dist/civet
CHANGED
|
@@ -33,6 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
33
33
|
var cli_civet_exports = {};
|
|
34
34
|
__export(cli_civet_exports, {
|
|
35
35
|
cli: () => cli,
|
|
36
|
+
makeOutputFilename: () => makeOutputFilename,
|
|
36
37
|
parseArgs: () => parseArgs,
|
|
37
38
|
repl: () => repl,
|
|
38
39
|
version: () => version
|
|
@@ -287,6 +288,22 @@ async function* readFiles(filenames, evalString) {
|
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
290
|
}
|
|
291
|
+
function makeOutputFilename(filename, options) {
|
|
292
|
+
let ref1;
|
|
293
|
+
const outputPath = (delete (ref1 = options.outputPath ?? import_node_path.default.parse(filename)).base, // use name and ext
|
|
294
|
+
ref1.ext += // default extension
|
|
295
|
+
options.js ? ".jsx" : ".tsx", (($) => {
|
|
296
|
+
if (options.outputDir != null) {
|
|
297
|
+
$.dir = options.outputDir;
|
|
298
|
+
}
|
|
299
|
+
if (options.outputExt != null) {
|
|
300
|
+
return $.ext = options.outputExt;
|
|
301
|
+
}
|
|
302
|
+
;
|
|
303
|
+
return;
|
|
304
|
+
})(ref1), ref1);
|
|
305
|
+
return import_node_path.default.format(outputPath);
|
|
306
|
+
}
|
|
290
307
|
async function repl(args, options) {
|
|
291
308
|
const vm = await import("node:vm");
|
|
292
309
|
let importModuleDynamically = vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
@@ -326,20 +343,24 @@ async function repl(args, options) {
|
|
|
326
343
|
})()} code.`);
|
|
327
344
|
global.quit = global.exit = () => process.exit(0);
|
|
328
345
|
const nodeRepl = await import("node:repl");
|
|
346
|
+
let ref2;
|
|
347
|
+
switch (false) {
|
|
348
|
+
case !options.ast: {
|
|
349
|
+
ref2 = "\u{1F332}> ";
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
case !options.compile: {
|
|
353
|
+
ref2 = "\u{1F408}> ";
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
default: {
|
|
357
|
+
ref2 = "\u{1F431}> ";
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
;
|
|
361
|
+
const prompt = ref2;
|
|
329
362
|
const r = nodeRepl.start({
|
|
330
|
-
prompt
|
|
331
|
-
switch (false) {
|
|
332
|
-
case !options.ast: {
|
|
333
|
-
return "\u{1F332}> ";
|
|
334
|
-
}
|
|
335
|
-
case !options.compile: {
|
|
336
|
-
return "\u{1F408}> ";
|
|
337
|
-
}
|
|
338
|
-
default: {
|
|
339
|
-
return "\u{1F431}> ";
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
})(),
|
|
363
|
+
prompt,
|
|
343
364
|
writer: (() => {
|
|
344
365
|
if (options.ast) {
|
|
345
366
|
return (obj) => {
|
|
@@ -444,7 +465,32 @@ ${" ".repeat(error.column - 1)}^ ${error.header}`);
|
|
|
444
465
|
}
|
|
445
466
|
}
|
|
446
467
|
});
|
|
447
|
-
|
|
468
|
+
const bufferedCommandSymbol = Object.getOwnPropertySymbols(r).find((symbol) => {
|
|
469
|
+
return symbol.description === "bufferedCommand";
|
|
470
|
+
});
|
|
471
|
+
const interfaceSetPrompt = Object.getPrototypeOf(Object.getPrototypeOf(r))?.setPrompt;
|
|
472
|
+
const writeToOutputSymbol = Object.getOwnPropertySymbols(Object.getPrototypeOf(Object.getPrototypeOf(r))).find((symbol) => {
|
|
473
|
+
return symbol.description === "_writeToOutput";
|
|
474
|
+
});
|
|
475
|
+
if (bufferedCommandSymbol && interfaceSetPrompt && writeToOutputSymbol) {
|
|
476
|
+
const originalWriteToOutput = r[writeToOutputSymbol];
|
|
477
|
+
Object.defineProperty(r, writeToOutputSymbol, {
|
|
478
|
+
value: (text) => {
|
|
479
|
+
return originalWriteToOutput.call(r, text.replace(/(^|\n)\| /g, "$1... "));
|
|
480
|
+
},
|
|
481
|
+
configurable: true,
|
|
482
|
+
writable: true
|
|
483
|
+
});
|
|
484
|
+
return r.displayPrompt = (preserveCursor) => {
|
|
485
|
+
interfaceSetPrompt.call(
|
|
486
|
+
r,
|
|
487
|
+
r[bufferedCommandSymbol]?.length ? "... " : prompt
|
|
488
|
+
);
|
|
489
|
+
return r.prompt(preserveCursor);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
;
|
|
493
|
+
return;
|
|
448
494
|
}
|
|
449
495
|
async function cli(args = process.argv.slice(2)) {
|
|
450
496
|
let { filenames, scriptArgs, options } = await parseArgs(args);
|
|
@@ -516,6 +562,28 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
516
562
|
}
|
|
517
563
|
}
|
|
518
564
|
if (options.typescript) {
|
|
565
|
+
if (!import_meta.url) {
|
|
566
|
+
try {
|
|
567
|
+
require("typescript");
|
|
568
|
+
} catch {
|
|
569
|
+
const modulePkg = require("node:module");
|
|
570
|
+
let ref3;
|
|
571
|
+
if (ref3 = __dirname.match(/([/\\]@danielx)?[/\\][cC]ivet[/\\]dist[/\\]?$/)) {
|
|
572
|
+
const match = ref3;
|
|
573
|
+
if (match[1]) {
|
|
574
|
+
modulePkg.globalPaths?.push(import_node_path.default.join(__dirname, "..", "..", ".."));
|
|
575
|
+
} else {
|
|
576
|
+
modulePkg.globalPaths?.push(import_node_path.default.join(__dirname, "..", ".."));
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
try {
|
|
580
|
+
require("typescript");
|
|
581
|
+
} catch {
|
|
582
|
+
console.error("Civet could not find TypeScript, which is required for --typecheck or --emit-declaration. Please install typescript using the same package manager you used to install @danielx/civet. With NPM for example: `npm install typescript` if you are local to a project, or `npm install -g typescript` if you installed Civet globally.");
|
|
583
|
+
process.exit(1);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
519
587
|
const unpluginOptions = {
|
|
520
588
|
...options,
|
|
521
589
|
ts: options.js ? "civet" : "preserve",
|
|
@@ -549,20 +617,7 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
549
617
|
errors++;
|
|
550
618
|
continue;
|
|
551
619
|
}
|
|
552
|
-
|
|
553
|
-
const outputPath = (delete (ref1 = options.outputPath ?? import_node_path.default.parse(filename)).base, // use name and ext
|
|
554
|
-
ref1.ext += // default extension
|
|
555
|
-
options.js ? ".jsx" : ".tsx", (($) => {
|
|
556
|
-
if (options.outputDir != null) {
|
|
557
|
-
$.dir = options.outputDir;
|
|
558
|
-
}
|
|
559
|
-
if (options.outputExt != null) {
|
|
560
|
-
return $.ext = options.outputExt;
|
|
561
|
-
}
|
|
562
|
-
;
|
|
563
|
-
return;
|
|
564
|
-
})(ref1), ref1);
|
|
565
|
-
const outputFilename = import_node_path.default.format(outputPath);
|
|
620
|
+
const outputFilename = makeOutputFilename(filename, options);
|
|
566
621
|
let output;
|
|
567
622
|
try {
|
|
568
623
|
if (unplugin != null) {
|
|
@@ -598,17 +653,17 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
598
653
|
}
|
|
599
654
|
}
|
|
600
655
|
} else if (options.run) {
|
|
601
|
-
let
|
|
656
|
+
let ref4;
|
|
602
657
|
{
|
|
603
658
|
if (typeof output === "string" && /\b(await|import|export)\b/.test(output)) {
|
|
604
659
|
const ast = await (0, import_main.compile)(content, { ...options, ast: true, filename });
|
|
605
|
-
|
|
660
|
+
ref4 = import_main.lib.hasAwait(ast) || import_main.lib.hasImportDeclaration(ast) || import_main.lib.hasExportDeclaration(ast);
|
|
606
661
|
} else {
|
|
607
|
-
|
|
662
|
+
ref4 = void 0;
|
|
608
663
|
}
|
|
609
664
|
}
|
|
610
665
|
;
|
|
611
|
-
const esm =
|
|
666
|
+
const esm = ref4;
|
|
612
667
|
if (esm) {
|
|
613
668
|
if (stdin) {
|
|
614
669
|
filename = `.stdin-${process.pid}.civet`;
|
|
@@ -688,9 +743,9 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
688
743
|
}
|
|
689
744
|
}, !filenames.length);
|
|
690
745
|
} catch (error) {
|
|
691
|
-
let
|
|
692
|
-
if (
|
|
693
|
-
const match =
|
|
746
|
+
let ref5;
|
|
747
|
+
if (ref5 = error.message.match(/Aborting build because of (\d+) TypeScript diagnostic/)) {
|
|
748
|
+
const match = ref5;
|
|
694
749
|
return process.exitCode = Math.min(255, errors + +match[1]);
|
|
695
750
|
} else {
|
|
696
751
|
process.exitCode = 1;
|
|
@@ -704,6 +759,7 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
704
759
|
// Annotate the CommonJS export names for ESM import in node:
|
|
705
760
|
0 && (module.exports = {
|
|
706
761
|
cli,
|
|
762
|
+
makeOutputFilename,
|
|
707
763
|
parseArgs,
|
|
708
764
|
repl,
|
|
709
765
|
version
|
package/dist/config.js
CHANGED
|
@@ -71,6 +71,9 @@ async function findInDir(dirPath) {
|
|
|
71
71
|
const configName = configNames[i];
|
|
72
72
|
for (let i1 = 0, len1 = configExtensions.length; i1 < len1; i1++) {
|
|
73
73
|
const extension = configExtensions[i1];
|
|
74
|
+
if (configName === "package" && (extension === ".civet" || extension === ".js")) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
74
77
|
for (let ref = ["." + configName + extension, configName + extension], i2 = 0, len2 = ref.length; i2 < len2; i2++) {
|
|
75
78
|
const entry = ref[i2];
|
|
76
79
|
if (entries.has(entry) && await (async () => {
|
package/dist/config.mjs
CHANGED
|
@@ -35,6 +35,9 @@ async function findInDir(dirPath) {
|
|
|
35
35
|
const configName = configNames[i];
|
|
36
36
|
for (let i1 = 0, len1 = configExtensions.length; i1 < len1; i1++) {
|
|
37
37
|
const extension = configExtensions[i1];
|
|
38
|
+
if (configName === "package" && (extension === ".civet" || extension === ".js")) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
38
41
|
for (let ref = ["." + configName + extension, configName + extension], i2 = 0, len2 = ref.length; i2 < len2; i2++) {
|
|
39
42
|
const entry = ref[i2];
|
|
40
43
|
if (entries.has(entry) && await (async () => {
|