@danielx/civet 0.6.50 → 0.6.52
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/dist/browser.js +191 -35
- package/dist/esbuild.js +42 -9
- package/dist/main.js +191 -35
- package/dist/main.mjs +191 -35
- package/dist/rollup.js +42 -9
- package/dist/unplugin-shared.mjs +43 -9
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.d.ts +2 -1
- package/dist/unplugin.js +48 -10
- package/dist/unplugin.mjs +3 -1
- package/dist/vite.js +42 -9
- package/dist/webpack.js +42 -9
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -3873,6 +3873,10 @@ var require_parser = __commonJS({
|
|
|
3873
3873
|
ShortArrowParameters,
|
|
3874
3874
|
ArrowParameters,
|
|
3875
3875
|
NonEmptyParameters,
|
|
3876
|
+
ParameterList,
|
|
3877
|
+
NestedParameterList,
|
|
3878
|
+
NestedParameter,
|
|
3879
|
+
Parameter,
|
|
3876
3880
|
FunctionRestParameter,
|
|
3877
3881
|
ParameterElement,
|
|
3878
3882
|
ParameterElementDelimiter,
|
|
@@ -4199,6 +4203,7 @@ var require_parser = __commonJS({
|
|
|
4199
4203
|
Case,
|
|
4200
4204
|
Catch,
|
|
4201
4205
|
Class,
|
|
4206
|
+
CloseAngleBracket,
|
|
4202
4207
|
CloseBrace,
|
|
4203
4208
|
CloseBracket,
|
|
4204
4209
|
CloseParen,
|
|
@@ -4670,7 +4675,7 @@ var require_parser = __commonJS({
|
|
|
4670
4675
|
var $R1 = $R(new RegExp("(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
4671
4676
|
var $R2 = $R(new RegExp("[0-9]", "suy"));
|
|
4672
4677
|
var $R3 = $R(new RegExp("[ \\t]", "suy"));
|
|
4673
|
-
var $R4 = $R(new RegExp("(?=['\"
|
|
4678
|
+
var $R4 = $R(new RegExp("(?=['\"`<])", "suy"));
|
|
4674
4679
|
var $R5 = $R(new RegExp("(?=[\\/?])", "suy"));
|
|
4675
4680
|
var $R6 = $R(new RegExp("(?=[\\/\\[{?.!@'\u2019:])", "suy"));
|
|
4676
4681
|
var $R7 = $R(new RegExp("[)}]", "suy"));
|
|
@@ -5318,8 +5323,11 @@ var require_parser = __commonJS({
|
|
|
5318
5323
|
function TrailingDeclaration(ctx, state) {
|
|
5319
5324
|
return $EVENT(ctx, state, "TrailingDeclaration", TrailingDeclaration$0);
|
|
5320
5325
|
}
|
|
5321
|
-
var FatArrowBody$0 = $
|
|
5322
|
-
var exp =
|
|
5326
|
+
var FatArrowBody$0 = $TS($S($N(EOS), NonPipelinePostfixedExpression, $N(TrailingDeclaration), $N(SemicolonDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
5327
|
+
var exp = $2;
|
|
5328
|
+
if (exp.type === "ObjectExpression") {
|
|
5329
|
+
return makeLeftHandSideExpression(exp);
|
|
5330
|
+
}
|
|
5323
5331
|
return exp;
|
|
5324
5332
|
});
|
|
5325
5333
|
var FatArrowBody$1 = NoCommaBracedOrEmptyBlock;
|
|
@@ -5791,12 +5799,15 @@ var require_parser = __commonJS({
|
|
|
5791
5799
|
return $EVENT_C(ctx, state, "CallExpression", CallExpression$$);
|
|
5792
5800
|
}
|
|
5793
5801
|
var CallExpressionRest$0 = MemberExpressionRest;
|
|
5794
|
-
var CallExpressionRest$1 = $TS($S($EXPECT($R4, "CallExpressionRest /(?=['\"
|
|
5795
|
-
var
|
|
5802
|
+
var CallExpressionRest$1 = $TS($S($EXPECT($R4, "CallExpressionRest /(?=['\"`<])/"), $E(TypeArguments), $C(TemplateLiteral, StringLiteral)), function($skip, $loc, $0, $1, $2, $3) {
|
|
5803
|
+
var args = $2;
|
|
5804
|
+
var literal = $3;
|
|
5796
5805
|
if (literal.type === "StringLiteral") {
|
|
5797
|
-
|
|
5806
|
+
literal = "`" + literal.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
|
|
5798
5807
|
}
|
|
5799
|
-
|
|
5808
|
+
if (!args)
|
|
5809
|
+
return literal;
|
|
5810
|
+
return [args, literal];
|
|
5800
5811
|
});
|
|
5801
5812
|
var CallExpressionRest$2 = $TS($S($E(OptionalShorthand), ArgumentsWithTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
|
|
5802
5813
|
if (!$1)
|
|
@@ -6136,15 +6147,55 @@ var require_parser = __commonJS({
|
|
|
6136
6147
|
function ArrowParameters(ctx, state) {
|
|
6137
6148
|
return $EVENT_C(ctx, state, "ArrowParameters", ArrowParameters$$);
|
|
6138
6149
|
}
|
|
6139
|
-
var NonEmptyParameters$0 = $TS($S($E(TypeParameters), OpenParen,
|
|
6150
|
+
var NonEmptyParameters$0 = $TS($S($E(TypeParameters), OpenParen, ParameterList, $S(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6140
6151
|
var tp = $1;
|
|
6141
6152
|
var open = $2;
|
|
6142
|
-
var
|
|
6143
|
-
var
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6153
|
+
var params = $3;
|
|
6154
|
+
var close = $4;
|
|
6155
|
+
let tt, before = [], rest, after = [], errors = [];
|
|
6156
|
+
function append(p) {
|
|
6157
|
+
(rest ? after : before).push(p);
|
|
6158
|
+
}
|
|
6159
|
+
for (const param of params) {
|
|
6160
|
+
switch (param.type) {
|
|
6161
|
+
case "ThisType":
|
|
6162
|
+
if (tt) {
|
|
6163
|
+
append({
|
|
6164
|
+
type: "Error",
|
|
6165
|
+
message: "Only one typed this parameter is allowed"
|
|
6166
|
+
});
|
|
6167
|
+
append(param);
|
|
6168
|
+
} else {
|
|
6169
|
+
tt = insertTrimmingSpace(param, "");
|
|
6170
|
+
if (before.length || rest) {
|
|
6171
|
+
let delim = tt.children.at(-1);
|
|
6172
|
+
if (Array.isArray(delim))
|
|
6173
|
+
delim = delim.at(-1);
|
|
6174
|
+
if (delim?.token !== ",") {
|
|
6175
|
+
tt = {
|
|
6176
|
+
...tt,
|
|
6177
|
+
children: [...tt.children, ", "]
|
|
6178
|
+
};
|
|
6179
|
+
}
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
break;
|
|
6183
|
+
case "FunctionRestParameter":
|
|
6184
|
+
if (rest) {
|
|
6185
|
+
append({
|
|
6186
|
+
type: "Error",
|
|
6187
|
+
message: "Only one rest parameter is allowed"
|
|
6188
|
+
});
|
|
6189
|
+
append(param);
|
|
6190
|
+
} else {
|
|
6191
|
+
rest = param;
|
|
6192
|
+
}
|
|
6193
|
+
break;
|
|
6194
|
+
default:
|
|
6195
|
+
append(param);
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
6198
|
+
const names = before.flatMap((p) => p.names);
|
|
6148
6199
|
if (rest) {
|
|
6149
6200
|
const restIdentifier = rest.binding.ref || rest.binding;
|
|
6150
6201
|
names.push(...rest.names || []);
|
|
@@ -6161,7 +6212,7 @@ var require_parser = __commonJS({
|
|
|
6161
6212
|
tp,
|
|
6162
6213
|
open,
|
|
6163
6214
|
tt,
|
|
6164
|
-
...
|
|
6215
|
+
...before,
|
|
6165
6216
|
// Remove delimiter
|
|
6166
6217
|
{ ...rest, children: rest.children.slice(0, -1) },
|
|
6167
6218
|
close
|
|
@@ -6173,19 +6224,61 @@ var require_parser = __commonJS({
|
|
|
6173
6224
|
}
|
|
6174
6225
|
return {
|
|
6175
6226
|
type: "Parameters",
|
|
6176
|
-
children: [tp, open, tt, ...
|
|
6177
|
-
names
|
|
6227
|
+
children: [tp, open, tt, ...before, close],
|
|
6228
|
+
names,
|
|
6178
6229
|
tp
|
|
6179
6230
|
};
|
|
6180
6231
|
});
|
|
6181
6232
|
function NonEmptyParameters(ctx, state) {
|
|
6182
6233
|
return $EVENT(ctx, state, "NonEmptyParameters", NonEmptyParameters$0);
|
|
6183
6234
|
}
|
|
6184
|
-
var
|
|
6235
|
+
var ParameterList$0 = $TS($S($Q(Parameter), NestedParameterList), function($skip, $loc, $0, $1, $2) {
|
|
6236
|
+
return [...$1, ...$2];
|
|
6237
|
+
});
|
|
6238
|
+
var ParameterList$1 = $TV($Q($S(__, Parameter)), function($skip, $loc, $0, $1) {
|
|
6239
|
+
return $1.map(([eos, p]) => ({
|
|
6240
|
+
...p,
|
|
6241
|
+
children: [eos, ...p.children]
|
|
6242
|
+
}));
|
|
6243
|
+
});
|
|
6244
|
+
var ParameterList$$ = [ParameterList$0, ParameterList$1];
|
|
6245
|
+
function ParameterList(ctx, state) {
|
|
6246
|
+
return $EVENT_C(ctx, state, "ParameterList", ParameterList$$);
|
|
6247
|
+
}
|
|
6248
|
+
var NestedParameterList$0 = $TS($S(PushIndent, $Q(NestedParameter), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
6249
|
+
var params = $2;
|
|
6250
|
+
if (!params.length)
|
|
6251
|
+
return $skip;
|
|
6252
|
+
return params;
|
|
6253
|
+
});
|
|
6254
|
+
function NestedParameterList(ctx, state) {
|
|
6255
|
+
return $EVENT(ctx, state, "NestedParameterList", NestedParameterList$0);
|
|
6256
|
+
}
|
|
6257
|
+
var NestedParameter$0 = $TS($S(Nested, $P(Parameter)), function($skip, $loc, $0, $1, $2) {
|
|
6258
|
+
var ws = $1;
|
|
6259
|
+
var params = $2;
|
|
6260
|
+
params = [...params];
|
|
6261
|
+
params[0] = {
|
|
6262
|
+
...params[0],
|
|
6263
|
+
children: [ws, ...params[0].children]
|
|
6264
|
+
};
|
|
6265
|
+
return params;
|
|
6266
|
+
});
|
|
6267
|
+
function NestedParameter(ctx, state) {
|
|
6268
|
+
return $EVENT(ctx, state, "NestedParameter", NestedParameter$0);
|
|
6269
|
+
}
|
|
6270
|
+
var Parameter$0 = ThisType;
|
|
6271
|
+
var Parameter$1 = ParameterElement;
|
|
6272
|
+
var Parameter$2 = FunctionRestParameter;
|
|
6273
|
+
var Parameter$$ = [Parameter$0, Parameter$1, Parameter$2];
|
|
6274
|
+
function Parameter(ctx, state) {
|
|
6275
|
+
return $EVENT_C(ctx, state, "Parameter", Parameter$$);
|
|
6276
|
+
}
|
|
6277
|
+
var FunctionRestParameter$0 = $TS($S($N(EOS), BindingRestElement, $E(TypeSuffix), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6185
6278
|
var id = $2;
|
|
6186
6279
|
return {
|
|
6187
6280
|
type: "FunctionRestParameter",
|
|
6188
|
-
children: $0,
|
|
6281
|
+
children: $0.slice(1),
|
|
6189
6282
|
names: id.names,
|
|
6190
6283
|
binding: id.binding
|
|
6191
6284
|
};
|
|
@@ -6193,12 +6286,14 @@ var require_parser = __commonJS({
|
|
|
6193
6286
|
function FunctionRestParameter(ctx, state) {
|
|
6194
6287
|
return $EVENT(ctx, state, "FunctionRestParameter", FunctionRestParameter$0);
|
|
6195
6288
|
}
|
|
6196
|
-
var ParameterElement$0 = $TS($S(
|
|
6289
|
+
var ParameterElement$0 = $TS($S($E(_), $E(AccessModifier), $E(_), $C(NWBindingIdentifier, BindingPattern), $E(TypeSuffix), $E(Initializer), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
6290
|
+
var accessModifier = $2;
|
|
6291
|
+
var binding = $4;
|
|
6197
6292
|
return {
|
|
6198
6293
|
type: "Parameter",
|
|
6199
6294
|
children: $0,
|
|
6200
|
-
names:
|
|
6201
|
-
accessModifier
|
|
6295
|
+
names: binding.names,
|
|
6296
|
+
accessModifier
|
|
6202
6297
|
};
|
|
6203
6298
|
});
|
|
6204
6299
|
function ParameterElement(ctx, state) {
|
|
@@ -6593,8 +6688,8 @@ var require_parser = __commonJS({
|
|
|
6593
6688
|
async,
|
|
6594
6689
|
generator,
|
|
6595
6690
|
modifier: {
|
|
6596
|
-
async:
|
|
6597
|
-
generator:
|
|
6691
|
+
async: !!async.length,
|
|
6692
|
+
generator: !!generator.length
|
|
6598
6693
|
},
|
|
6599
6694
|
block: null,
|
|
6600
6695
|
children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
|
|
@@ -6617,9 +6712,11 @@ var require_parser = __commonJS({
|
|
|
6617
6712
|
}
|
|
6618
6713
|
if (hasAwait(block) && !signature.async.length) {
|
|
6619
6714
|
signature.async.push("async ");
|
|
6715
|
+
signature.modifier.async = true;
|
|
6620
6716
|
}
|
|
6621
6717
|
if (hasYield(block) && !signature.generator.length) {
|
|
6622
6718
|
signature.generator.push("*");
|
|
6719
|
+
signature.modifier.generator = true;
|
|
6623
6720
|
}
|
|
6624
6721
|
return {
|
|
6625
6722
|
...signature,
|
|
@@ -6794,10 +6891,11 @@ var require_parser = __commonJS({
|
|
|
6794
6891
|
function AmpersandBlockRHS(ctx, state) {
|
|
6795
6892
|
return $EVENT(ctx, state, "AmpersandBlockRHS", AmpersandBlockRHS$0);
|
|
6796
6893
|
}
|
|
6797
|
-
var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E(QuestionMark), $E($S($N($EXPECT($R8, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2, $3) {
|
|
6894
|
+
var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E(QuestionMark), $E($S(WAssignmentOp, $Q($S(NotDedented, UpdateExpression, WAssignmentOp)), NonPipelineExtendedExpression)), $E($S($N($EXPECT($R8, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6798
6895
|
var callExpRest = $1;
|
|
6799
6896
|
var unaryPostfix = $2;
|
|
6800
|
-
var
|
|
6897
|
+
var assign = $3;
|
|
6898
|
+
var binopRHS = $4;
|
|
6801
6899
|
if (!callExpRest && !binopRHS && !unaryPostfix)
|
|
6802
6900
|
return $skip;
|
|
6803
6901
|
const ref = makeRef("$");
|
|
@@ -6813,8 +6911,24 @@ var require_parser = __commonJS({
|
|
|
6813
6911
|
if (unaryPostfix) {
|
|
6814
6912
|
exp = processUnaryExpression([], exp, unaryPostfix);
|
|
6815
6913
|
}
|
|
6914
|
+
if (assign) {
|
|
6915
|
+
const [op1, more, rhs] = assign;
|
|
6916
|
+
const lhs = [
|
|
6917
|
+
[void 0, exp, ...op1],
|
|
6918
|
+
...more.map((x) => [x[0], x[1], ...x[2]])
|
|
6919
|
+
];
|
|
6920
|
+
exp = {
|
|
6921
|
+
type: "AssignmentExpression",
|
|
6922
|
+
children: [lhs, rhs],
|
|
6923
|
+
names: null,
|
|
6924
|
+
lhs,
|
|
6925
|
+
assigned: exp,
|
|
6926
|
+
exp: rhs,
|
|
6927
|
+
ref
|
|
6928
|
+
};
|
|
6929
|
+
}
|
|
6816
6930
|
if (binopRHS) {
|
|
6817
|
-
|
|
6931
|
+
exp = {
|
|
6818
6932
|
children: processBinaryOpExpression([exp, binopRHS[1]]),
|
|
6819
6933
|
ref
|
|
6820
6934
|
};
|
|
@@ -10699,6 +10813,12 @@ var require_parser = __commonJS({
|
|
|
10699
10813
|
function Class(ctx, state) {
|
|
10700
10814
|
return $EVENT(ctx, state, "Class", Class$0);
|
|
10701
10815
|
}
|
|
10816
|
+
var CloseAngleBracket$0 = $TV($EXPECT($L33, 'CloseAngleBracket ">"'), function($skip, $loc, $0, $1) {
|
|
10817
|
+
return { $loc, token: $1 };
|
|
10818
|
+
});
|
|
10819
|
+
function CloseAngleBracket(ctx, state) {
|
|
10820
|
+
return $EVENT(ctx, state, "CloseAngleBracket", CloseAngleBracket$0);
|
|
10821
|
+
}
|
|
10702
10822
|
var CloseBrace$0 = $TV($EXPECT($L25, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
|
|
10703
10823
|
return { $loc, token: $1 };
|
|
10704
10824
|
});
|
|
@@ -12497,9 +12617,14 @@ var require_parser = __commonJS({
|
|
|
12497
12617
|
function TypeArrowFunction(ctx, state) {
|
|
12498
12618
|
return $EVENT(ctx, state, "TypeArrowFunction", TypeArrowFunction$0);
|
|
12499
12619
|
}
|
|
12500
|
-
var TypeArguments$0 = $TS($S(
|
|
12620
|
+
var TypeArguments$0 = $TS($S(OpenAngleBracket, $P(TypeArgument), __, CloseAngleBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12501
12621
|
var args = $2;
|
|
12502
|
-
return {
|
|
12622
|
+
return {
|
|
12623
|
+
type: "TypeArguments",
|
|
12624
|
+
ts: true,
|
|
12625
|
+
types: args.map(([, t]) => t),
|
|
12626
|
+
children: $0
|
|
12627
|
+
};
|
|
12503
12628
|
});
|
|
12504
12629
|
function TypeArguments(ctx, state) {
|
|
12505
12630
|
return $EVENT(ctx, state, "TypeArguments", TypeArguments$0);
|
|
@@ -12512,7 +12637,7 @@ var require_parser = __commonJS({
|
|
|
12512
12637
|
function TypeArgumentDelimiter(ctx, state) {
|
|
12513
12638
|
return $EVENT(ctx, state, "TypeArgumentDelimiter", TypeArgumentDelimiter$0);
|
|
12514
12639
|
}
|
|
12515
|
-
var TypeParameters$0 = $TS($S($E(_),
|
|
12640
|
+
var TypeParameters$0 = $TS($S($E(_), OpenAngleBracket, $P(TypeParameter), __, CloseAngleBracket), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12516
12641
|
var parameters = $3;
|
|
12517
12642
|
return {
|
|
12518
12643
|
type: "TypeParameters",
|
|
@@ -12545,7 +12670,7 @@ var require_parser = __commonJS({
|
|
|
12545
12670
|
function TypeParameterDelimiter(ctx, state) {
|
|
12546
12671
|
return $EVENT_C(ctx, state, "TypeParameterDelimiter", TypeParameterDelimiter$$);
|
|
12547
12672
|
}
|
|
12548
|
-
var ThisType$0 = $T($S($C(This, AtThis), Colon, Type, ParameterElementDelimiter), function(value) {
|
|
12673
|
+
var ThisType$0 = $T($S($E(_), $C(This, AtThis), Colon, Type, ParameterElementDelimiter), function(value) {
|
|
12549
12674
|
return { "type": "ThisType", "ts": true, "children": value };
|
|
12550
12675
|
});
|
|
12551
12676
|
function ThisType(ctx, state) {
|
|
@@ -12988,19 +13113,45 @@ var require_parser = __commonJS({
|
|
|
12988
13113
|
};
|
|
12989
13114
|
module.prelude.push(["", [preludeVar, moduloRef, typeSuffix, " = (a, b) => (a % b + b) % b;", "\n"]]);
|
|
12990
13115
|
},
|
|
13116
|
+
Falsy(FalsyRef) {
|
|
13117
|
+
module.prelude.push(["", [{
|
|
13118
|
+
ts: true,
|
|
13119
|
+
children: ["type ", FalsyRef, " = false | 0 | '' | 0n | null | undefined;", "\n"]
|
|
13120
|
+
}]]);
|
|
13121
|
+
},
|
|
12991
13122
|
xor(xorRef) {
|
|
13123
|
+
const Falsy = module.getRef("Falsy");
|
|
12992
13124
|
const typeSuffix = {
|
|
12993
13125
|
ts: true,
|
|
12994
|
-
children: [
|
|
13126
|
+
children: [
|
|
13127
|
+
": <A, B>(a: A, b: B) => A extends ",
|
|
13128
|
+
Falsy,
|
|
13129
|
+
" ? B : B extends ",
|
|
13130
|
+
Falsy,
|
|
13131
|
+
" ? A : (false | (A & ",
|
|
13132
|
+
Falsy,
|
|
13133
|
+
" extends never ? never : B) | (B & ",
|
|
13134
|
+
Falsy,
|
|
13135
|
+
" extends never ? never : A))"
|
|
13136
|
+
]
|
|
12995
13137
|
};
|
|
12996
|
-
module.prelude.push(["", [preludeVar, xorRef, typeSuffix, " = (a, b) => a ? !b && a : b;", "\n"]]);
|
|
13138
|
+
module.prelude.push(["", [preludeVar, xorRef, typeSuffix, " = (a, b) => (a ? !b && a : b)", asAny, ";", "\n"]]);
|
|
12997
13139
|
},
|
|
12998
13140
|
xnor(xnorRef) {
|
|
13141
|
+
const Falsy = module.getRef("Falsy");
|
|
12999
13142
|
const typeSuffix = {
|
|
13000
13143
|
ts: true,
|
|
13001
|
-
children: [
|
|
13144
|
+
children: [
|
|
13145
|
+
": <A, B>(a: A, b: B) => A & ",
|
|
13146
|
+
Falsy,
|
|
13147
|
+
" extends never ? B : (true | (B extends ",
|
|
13148
|
+
Falsy,
|
|
13149
|
+
" ? never : A) | (A extends ",
|
|
13150
|
+
Falsy,
|
|
13151
|
+
" ? never : B))"
|
|
13152
|
+
]
|
|
13002
13153
|
};
|
|
13003
|
-
module.prelude.push(["", [preludeVar, xnorRef, typeSuffix, " = (a, b) => a ? b : !b || a;", "\n"]]);
|
|
13154
|
+
module.prelude.push(["", [preludeVar, xnorRef, typeSuffix, " = (a, b) => (a ? b : !b || a)", asAny, ";", "\n"]]);
|
|
13004
13155
|
},
|
|
13005
13156
|
returnSymbol(ref) {
|
|
13006
13157
|
module.prelude.push({
|
|
@@ -13340,6 +13491,10 @@ var require_parser = __commonJS({
|
|
|
13340
13491
|
exports.ShortArrowParameters = ShortArrowParameters;
|
|
13341
13492
|
exports.ArrowParameters = ArrowParameters;
|
|
13342
13493
|
exports.NonEmptyParameters = NonEmptyParameters;
|
|
13494
|
+
exports.ParameterList = ParameterList;
|
|
13495
|
+
exports.NestedParameterList = NestedParameterList;
|
|
13496
|
+
exports.NestedParameter = NestedParameter;
|
|
13497
|
+
exports.Parameter = Parameter;
|
|
13343
13498
|
exports.FunctionRestParameter = FunctionRestParameter;
|
|
13344
13499
|
exports.ParameterElement = ParameterElement;
|
|
13345
13500
|
exports.ParameterElementDelimiter = ParameterElementDelimiter;
|
|
@@ -13666,6 +13821,7 @@ var require_parser = __commonJS({
|
|
|
13666
13821
|
exports.Case = Case;
|
|
13667
13822
|
exports.Catch = Catch;
|
|
13668
13823
|
exports.Class = Class;
|
|
13824
|
+
exports.CloseAngleBracket = CloseAngleBracket;
|
|
13669
13825
|
exports.CloseBrace = CloseBrace;
|
|
13670
13826
|
exports.CloseBracket = CloseBracket;
|
|
13671
13827
|
exports.CloseParen = CloseParen;
|
package/dist/rollup.js
CHANGED
|
@@ -42,14 +42,46 @@ var fs = __toESM(require("fs"));
|
|
|
42
42
|
var import_path = __toESM(require("path"));
|
|
43
43
|
var import_typescript = __toESM(require("typescript"));
|
|
44
44
|
var tsvfs = __toESM(require("@typescript/vfs"));
|
|
45
|
+
var import_os = __toESM(require("os"));
|
|
45
46
|
var formatHost = {
|
|
46
47
|
getCurrentDirectory: () => import_typescript.default.sys.getCurrentDirectory(),
|
|
47
48
|
getNewLine: () => import_typescript.default.sys.newLine,
|
|
48
49
|
getCanonicalFileName: import_typescript.default.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
49
50
|
};
|
|
50
51
|
var isCivet = (id) => /\.civet$/.test(id);
|
|
51
|
-
var isCivetTranspiled = (id) => /\.civet\.(
|
|
52
|
-
var isCivetTranspiledTS = (id) => /\.civet\.
|
|
52
|
+
var isCivetTranspiled = (id) => /\.civet\.[jt]sx(\?transform)?$/.test(id);
|
|
53
|
+
var isCivetTranspiledTS = (id) => /\.civet\.tsx$/.test(id);
|
|
54
|
+
var postfixRE = /(\.[jt]sx)?[?#].*$/s;
|
|
55
|
+
var isWindows = import_os.default.platform() === "win32";
|
|
56
|
+
var windowsSlashRE = /\\/g;
|
|
57
|
+
function cleanCivetId(id) {
|
|
58
|
+
return id.replace(postfixRE, "");
|
|
59
|
+
}
|
|
60
|
+
function tryStatSync(file) {
|
|
61
|
+
try {
|
|
62
|
+
return fs.statSync(file, { throwIfNoEntry: false });
|
|
63
|
+
} catch {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function slash(p) {
|
|
68
|
+
return p.replace(windowsSlashRE, "/");
|
|
69
|
+
}
|
|
70
|
+
function normalizePath(id) {
|
|
71
|
+
return import_path.default.posix.normalize(isWindows ? slash(id) : id);
|
|
72
|
+
}
|
|
73
|
+
function tryFsResolve(file) {
|
|
74
|
+
const fileStat = tryStatSync(file);
|
|
75
|
+
if (fileStat?.isFile())
|
|
76
|
+
return normalizePath(file);
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
function resolveAbsolutePath(rootDir, id) {
|
|
80
|
+
const resolved = tryFsResolve(import_path.default.join(rootDir, id));
|
|
81
|
+
if (!resolved)
|
|
82
|
+
return tryFsResolve(id);
|
|
83
|
+
return resolved;
|
|
84
|
+
}
|
|
53
85
|
var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
54
86
|
if (options.dts && options.js) {
|
|
55
87
|
throw new Error("Can't have both `dts` and `js` be set to `true`.");
|
|
@@ -62,7 +94,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
|
62
94
|
let fsMap = /* @__PURE__ */ new Map();
|
|
63
95
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
64
96
|
let compilerOptions;
|
|
65
|
-
let rootDir;
|
|
97
|
+
let rootDir = process.cwd();
|
|
66
98
|
return {
|
|
67
99
|
name: "unplugin-civet",
|
|
68
100
|
enforce: "pre",
|
|
@@ -162,10 +194,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
|
162
194
|
return null;
|
|
163
195
|
if (!isCivet(id) && !isCivetTranspiled(id))
|
|
164
196
|
return null;
|
|
165
|
-
|
|
197
|
+
id = cleanCivetId(id);
|
|
198
|
+
const absolutePath = import_path.default.isAbsolute(id) ? resolveAbsolutePath(rootDir, id) : import_path.default.resolve(import_path.default.dirname(importer ?? ""), id);
|
|
199
|
+
if (!absolutePath)
|
|
200
|
+
return null;
|
|
166
201
|
const relativeId = import_path.default.relative(process.cwd(), absolutePath);
|
|
167
|
-
if (isCivetTranspiled(id))
|
|
168
|
-
return relativeId.replace(/\?transform$/, "");
|
|
169
202
|
const relativePath = relativeId + outExt;
|
|
170
203
|
return relativePath;
|
|
171
204
|
},
|
|
@@ -206,9 +239,9 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
|
206
239
|
if (options.dts || options.typecheck) {
|
|
207
240
|
const resolved = import_path.default.resolve(process.cwd(), id);
|
|
208
241
|
fsMap.set(resolved, code);
|
|
209
|
-
const
|
|
210
|
-
if (resolved !==
|
|
211
|
-
fsMap.set(
|
|
242
|
+
const slashed = slash(resolved);
|
|
243
|
+
if (resolved !== slashed)
|
|
244
|
+
fsMap.set(slashed, code);
|
|
212
245
|
}
|
|
213
246
|
return null;
|
|
214
247
|
},
|
package/dist/unplugin-shared.mjs
CHANGED
|
@@ -11,14 +11,46 @@ import * as fs from "fs";
|
|
|
11
11
|
import path from "path";
|
|
12
12
|
import ts from "typescript";
|
|
13
13
|
import * as tsvfs from "@typescript/vfs";
|
|
14
|
+
import os from "os";
|
|
14
15
|
var formatHost = {
|
|
15
16
|
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
16
17
|
getNewLine: () => ts.sys.newLine,
|
|
17
18
|
getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
18
19
|
};
|
|
19
20
|
var isCivet = (id) => /\.civet$/.test(id);
|
|
20
|
-
var isCivetTranspiled = (id) => /\.civet\.(
|
|
21
|
-
var isCivetTranspiledTS = (id) => /\.civet\.
|
|
21
|
+
var isCivetTranspiled = (id) => /\.civet\.[jt]sx(\?transform)?$/.test(id);
|
|
22
|
+
var isCivetTranspiledTS = (id) => /\.civet\.tsx$/.test(id);
|
|
23
|
+
var postfixRE = /(\.[jt]sx)?[?#].*$/s;
|
|
24
|
+
var isWindows = os.platform() === "win32";
|
|
25
|
+
var windowsSlashRE = /\\/g;
|
|
26
|
+
function cleanCivetId(id) {
|
|
27
|
+
return id.replace(postfixRE, "");
|
|
28
|
+
}
|
|
29
|
+
function tryStatSync(file) {
|
|
30
|
+
try {
|
|
31
|
+
return fs.statSync(file, { throwIfNoEntry: false });
|
|
32
|
+
} catch {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function slash(p) {
|
|
37
|
+
return p.replace(windowsSlashRE, "/");
|
|
38
|
+
}
|
|
39
|
+
function normalizePath(id) {
|
|
40
|
+
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
41
|
+
}
|
|
42
|
+
function tryFsResolve(file) {
|
|
43
|
+
const fileStat = tryStatSync(file);
|
|
44
|
+
if (fileStat?.isFile())
|
|
45
|
+
return normalizePath(file);
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
function resolveAbsolutePath(rootDir, id) {
|
|
49
|
+
const resolved = tryFsResolve(path.join(rootDir, id));
|
|
50
|
+
if (!resolved)
|
|
51
|
+
return tryFsResolve(id);
|
|
52
|
+
return resolved;
|
|
53
|
+
}
|
|
22
54
|
var civetUnplugin = createUnplugin((options = {}) => {
|
|
23
55
|
if (options.dts && options.js) {
|
|
24
56
|
throw new Error("Can't have both `dts` and `js` be set to `true`.");
|
|
@@ -31,7 +63,7 @@ var civetUnplugin = createUnplugin((options = {}) => {
|
|
|
31
63
|
let fsMap = /* @__PURE__ */ new Map();
|
|
32
64
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
33
65
|
let compilerOptions;
|
|
34
|
-
let rootDir;
|
|
66
|
+
let rootDir = process.cwd();
|
|
35
67
|
return {
|
|
36
68
|
name: "unplugin-civet",
|
|
37
69
|
enforce: "pre",
|
|
@@ -131,10 +163,11 @@ var civetUnplugin = createUnplugin((options = {}) => {
|
|
|
131
163
|
return null;
|
|
132
164
|
if (!isCivet(id) && !isCivetTranspiled(id))
|
|
133
165
|
return null;
|
|
134
|
-
|
|
166
|
+
id = cleanCivetId(id);
|
|
167
|
+
const absolutePath = path.isAbsolute(id) ? resolveAbsolutePath(rootDir, id) : path.resolve(path.dirname(importer ?? ""), id);
|
|
168
|
+
if (!absolutePath)
|
|
169
|
+
return null;
|
|
135
170
|
const relativeId = path.relative(process.cwd(), absolutePath);
|
|
136
|
-
if (isCivetTranspiled(id))
|
|
137
|
-
return relativeId.replace(/\?transform$/, "");
|
|
138
171
|
const relativePath = relativeId + outExt;
|
|
139
172
|
return relativePath;
|
|
140
173
|
},
|
|
@@ -175,9 +208,9 @@ var civetUnplugin = createUnplugin((options = {}) => {
|
|
|
175
208
|
if (options.dts || options.typecheck) {
|
|
176
209
|
const resolved = path.resolve(process.cwd(), id);
|
|
177
210
|
fsMap.set(resolved, code);
|
|
178
|
-
const
|
|
179
|
-
if (resolved !==
|
|
180
|
-
fsMap.set(
|
|
211
|
+
const slashed = slash(resolved);
|
|
212
|
+
if (resolved !== slashed)
|
|
213
|
+
fsMap.set(slashed, code);
|
|
181
214
|
}
|
|
182
215
|
return null;
|
|
183
216
|
},
|
|
@@ -218,5 +251,6 @@ var civetUnplugin = createUnplugin((options = {}) => {
|
|
|
218
251
|
var src_default = civetUnplugin;
|
|
219
252
|
|
|
220
253
|
export {
|
|
254
|
+
slash,
|
|
221
255
|
src_default
|
|
222
256
|
};
|
package/dist/unplugin.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ type PluginOptions = {
|
|
|
13
13
|
typecheck?: true;
|
|
14
14
|
js?: false;
|
|
15
15
|
});
|
|
16
|
+
declare function slash(p: string): string;
|
|
16
17
|
declare const civetUnplugin: unplugin.UnpluginInstance<PluginOptions, boolean>;
|
|
17
18
|
|
|
18
|
-
export { PluginOptions, civetUnplugin as default };
|
|
19
|
+
export { PluginOptions, civetUnplugin as default, slash };
|
package/dist/unplugin.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ type PluginOptions = {
|
|
|
13
13
|
typecheck?: true;
|
|
14
14
|
js?: false;
|
|
15
15
|
});
|
|
16
|
+
declare function slash(p: string): string;
|
|
16
17
|
declare const civetUnplugin: unplugin.UnpluginInstance<PluginOptions, boolean>;
|
|
17
18
|
|
|
18
|
-
export { PluginOptions, civetUnplugin as default };
|
|
19
|
+
export { PluginOptions, civetUnplugin as default, slash };
|