@danielx/civet 0.6.67 → 0.6.68
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 +83 -25
- package/dist/civet +1 -1
- package/dist/config.js +4 -4
- package/dist/esbuild-plugin.js +0 -2
- package/dist/main.js +804 -746
- package/dist/main.mjs +82 -24
- package/package.json +3 -3
package/dist/main.mjs
CHANGED
|
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
7
|
var __esm = (fn, res) => function __init() {
|
|
9
8
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
9
|
};
|
|
@@ -31,10 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
30
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
31
|
mod
|
|
33
32
|
));
|
|
34
|
-
var __publicField = (obj, key, value) => {
|
|
35
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
|
-
return value;
|
|
37
|
-
};
|
|
38
33
|
|
|
39
34
|
// source/lib.civet
|
|
40
35
|
var lib_exports = {};
|
|
@@ -642,7 +637,7 @@ function handleThisPrivateShorthands(value) {
|
|
|
642
637
|
if (i === 0) {
|
|
643
638
|
let s;
|
|
644
639
|
[c, s] = handleThisPrivateShorthands(c);
|
|
645
|
-
suppressPrefix
|
|
640
|
+
suppressPrefix ||= s;
|
|
646
641
|
}
|
|
647
642
|
return c;
|
|
648
643
|
})
|
|
@@ -3153,7 +3148,7 @@ function processReturnValue(func) {
|
|
|
3153
3148
|
isFunction
|
|
3154
3149
|
);
|
|
3155
3150
|
if (ancestor) {
|
|
3156
|
-
return declaration
|
|
3151
|
+
return declaration ??= child;
|
|
3157
3152
|
}
|
|
3158
3153
|
;
|
|
3159
3154
|
return;
|
|
@@ -3324,6 +3319,9 @@ function reorderBindingRestProperty(props) {
|
|
|
3324
3319
|
}
|
|
3325
3320
|
];
|
|
3326
3321
|
}
|
|
3322
|
+
if (rest.delim?.at(-1)?.token === ",") {
|
|
3323
|
+
rest.delim.pop();
|
|
3324
|
+
}
|
|
3327
3325
|
const children = [...props, ...after, rest];
|
|
3328
3326
|
return {
|
|
3329
3327
|
children,
|
|
@@ -4175,6 +4173,7 @@ var require_parser = __commonJS({
|
|
|
4175
4173
|
BareNestedBlock,
|
|
4176
4174
|
BareBlock,
|
|
4177
4175
|
ThenClause,
|
|
4176
|
+
BracedThenClause,
|
|
4178
4177
|
BracedOrEmptyBlock,
|
|
4179
4178
|
NoCommaBracedOrEmptyBlock,
|
|
4180
4179
|
NoPostfixBracedOrEmptyBlock,
|
|
@@ -5234,7 +5233,7 @@ var require_parser = __commonJS({
|
|
|
5234
5233
|
return $0;
|
|
5235
5234
|
return $skip;
|
|
5236
5235
|
});
|
|
5237
|
-
var ForbiddenImplicitCalls$5 = $TS($S(
|
|
5236
|
+
var ForbiddenImplicitCalls$5 = $TS($S(OmittedNegation, $E(_), Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
5238
5237
|
var id = $3;
|
|
5239
5238
|
if (module.operators.has(id.name))
|
|
5240
5239
|
return $0;
|
|
@@ -5759,11 +5758,29 @@ var require_parser = __commonJS({
|
|
|
5759
5758
|
function ParenthesizedExpression(ctx, state) {
|
|
5760
5759
|
return $EVENT(ctx, state, "ParenthesizedExpression", ParenthesizedExpression$0);
|
|
5761
5760
|
}
|
|
5762
|
-
var ClassDeclaration$0 = ClassExpression
|
|
5761
|
+
var ClassDeclaration$0 = $TS($S(ClassExpression), function($skip, $loc, $0, $1) {
|
|
5762
|
+
if ($1.binding)
|
|
5763
|
+
return $1;
|
|
5764
|
+
return makeLeftHandSideExpression($1);
|
|
5765
|
+
});
|
|
5763
5766
|
function ClassDeclaration(ctx, state) {
|
|
5764
5767
|
return $EVENT(ctx, state, "ClassDeclaration", ClassDeclaration$0);
|
|
5765
5768
|
}
|
|
5766
|
-
var ClassExpression$0 = $S($E(Decorators), $E($S(Abstract, __)), Class, $N($EXPECT($L13, 'ClassExpression ":"')), $E(ClassBinding), $E(ClassHeritage), ClassBody)
|
|
5769
|
+
var ClassExpression$0 = $TS($S($E(Decorators), $E($S(Abstract, __)), Class, $N($EXPECT($L13, 'ClassExpression ":"')), $E(ClassBinding), $E(ClassHeritage), ClassBody), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
5770
|
+
var decorators = $1;
|
|
5771
|
+
var abstract = $2;
|
|
5772
|
+
var binding = $5;
|
|
5773
|
+
var heritage = $6;
|
|
5774
|
+
var body = $7;
|
|
5775
|
+
return {
|
|
5776
|
+
decorators,
|
|
5777
|
+
abstract,
|
|
5778
|
+
binding,
|
|
5779
|
+
heritage,
|
|
5780
|
+
body,
|
|
5781
|
+
children: $0
|
|
5782
|
+
};
|
|
5783
|
+
});
|
|
5767
5784
|
function ClassExpression(ctx, state) {
|
|
5768
5785
|
return $EVENT(ctx, state, "ClassExpression", ClassExpression$0);
|
|
5769
5786
|
}
|
|
@@ -7463,6 +7480,21 @@ var require_parser = __commonJS({
|
|
|
7463
7480
|
function ThenClause(ctx, state) {
|
|
7464
7481
|
return $EVENT(ctx, state, "ThenClause", ThenClause$0);
|
|
7465
7482
|
}
|
|
7483
|
+
var BracedThenClause$0 = $TS($S($Y(Then), InsertOpenBrace, ThenClause, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
7484
|
+
var open = $2;
|
|
7485
|
+
var exp = $3;
|
|
7486
|
+
var close = $4;
|
|
7487
|
+
const expressions = [exp];
|
|
7488
|
+
return {
|
|
7489
|
+
type: "BlockStatement",
|
|
7490
|
+
expressions,
|
|
7491
|
+
children: [open, expressions, " ", close],
|
|
7492
|
+
bare: false
|
|
7493
|
+
};
|
|
7494
|
+
});
|
|
7495
|
+
function BracedThenClause(ctx, state) {
|
|
7496
|
+
return $EVENT(ctx, state, "BracedThenClause", BracedThenClause$0);
|
|
7497
|
+
}
|
|
7466
7498
|
var BracedOrEmptyBlock$0 = BracedBlock;
|
|
7467
7499
|
var BracedOrEmptyBlock$1 = EmptyBlock;
|
|
7468
7500
|
var BracedOrEmptyBlock$$ = [BracedOrEmptyBlock$0, BracedOrEmptyBlock$1];
|
|
@@ -8748,7 +8780,7 @@ var require_parser = __commonJS({
|
|
|
8748
8780
|
special: true
|
|
8749
8781
|
};
|
|
8750
8782
|
});
|
|
8751
|
-
var _BinaryOp$2 = $TS($S(
|
|
8783
|
+
var _BinaryOp$2 = $TS($S(OmittedNegation, __, Identifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
8752
8784
|
var id = $3;
|
|
8753
8785
|
if (!module.operators.has(id.name))
|
|
8754
8786
|
return $skip;
|
|
@@ -8885,7 +8917,7 @@ var require_parser = __commonJS({
|
|
|
8885
8917
|
var op = value[1];
|
|
8886
8918
|
return op;
|
|
8887
8919
|
});
|
|
8888
|
-
var BinaryOpSymbol$41 = $TS($S(
|
|
8920
|
+
var BinaryOpSymbol$41 = $TS($S(OmittedNegation, __, NotOp), function($skip, $loc, $0, $1, $2, $3) {
|
|
8889
8921
|
var op = $3;
|
|
8890
8922
|
return { ...op, $loc };
|
|
8891
8923
|
});
|
|
@@ -8912,7 +8944,7 @@ var require_parser = __commonJS({
|
|
|
8912
8944
|
negated: true
|
|
8913
8945
|
};
|
|
8914
8946
|
});
|
|
8915
|
-
var BinaryOpSymbol$45 = $TV($C($S(Is, __,
|
|
8947
|
+
var BinaryOpSymbol$45 = $TV($C($S(Is, __, OmittedNegation, __, In), $EXPECT($L99, 'BinaryOpSymbol "\u2209"')), function($skip, $loc, $0, $1) {
|
|
8916
8948
|
return {
|
|
8917
8949
|
method: "includes",
|
|
8918
8950
|
relational: true,
|
|
@@ -8964,7 +8996,7 @@ var require_parser = __commonJS({
|
|
|
8964
8996
|
special: true
|
|
8965
8997
|
};
|
|
8966
8998
|
});
|
|
8967
|
-
var CoffeeOfOp$2 = $TS($S(
|
|
8999
|
+
var CoffeeOfOp$2 = $TS($S(OmittedNegation, __, Of, NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8968
9000
|
return {
|
|
8969
9001
|
$loc,
|
|
8970
9002
|
token: "in",
|
|
@@ -8972,7 +9004,7 @@ var require_parser = __commonJS({
|
|
|
8972
9004
|
negated: true
|
|
8973
9005
|
};
|
|
8974
9006
|
});
|
|
8975
|
-
var CoffeeOfOp$3 = $TS($S(
|
|
9007
|
+
var CoffeeOfOp$3 = $TS($S(OmittedNegation, __, In), function($skip, $loc, $0, $1, $2, $3) {
|
|
8976
9008
|
return {
|
|
8977
9009
|
call: [module.getRef("indexOf"), ".call"],
|
|
8978
9010
|
relational: true,
|
|
@@ -9985,7 +10017,7 @@ var require_parser = __commonJS({
|
|
|
9985
10017
|
function TryExpression(ctx, state) {
|
|
9986
10018
|
return $EVENT(ctx, state, "TryExpression", TryExpression$0);
|
|
9987
10019
|
}
|
|
9988
|
-
var CatchClause$0 = $TS($S($C(Nested, _), Catch, $E(CatchBind), $C(
|
|
10020
|
+
var CatchClause$0 = $TS($S($C(Nested, _), Catch, $E(CatchBind), $C(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9989
10021
|
var block = $4;
|
|
9990
10022
|
return {
|
|
9991
10023
|
type: "CatchClause",
|
|
@@ -10002,7 +10034,7 @@ var require_parser = __commonJS({
|
|
|
10002
10034
|
function CatchBind(ctx, state) {
|
|
10003
10035
|
return $EVENT_C(ctx, state, "CatchBind", CatchBind$$);
|
|
10004
10036
|
}
|
|
10005
|
-
var FinallyClause$0 = $S($C(Nested, _), Finally, $C(
|
|
10037
|
+
var FinallyClause$0 = $S($C(Nested, _), Finally, $C(BracedThenClause, BracedOrEmptyBlock));
|
|
10006
10038
|
function FinallyClause(ctx, state) {
|
|
10007
10039
|
return $EVENT(ctx, state, "FinallyClause", FinallyClause$0);
|
|
10008
10040
|
}
|
|
@@ -12002,7 +12034,13 @@ var require_parser = __commonJS({
|
|
|
12002
12034
|
classValue = ["{[", ...exprs, '].filter(Boolean).join(" ")}'];
|
|
12003
12035
|
}
|
|
12004
12036
|
} else {
|
|
12005
|
-
|
|
12037
|
+
if (!stringPart.includes("&") && !stringPart.includes('"')) {
|
|
12038
|
+
classValue = `"${stringPart}"`;
|
|
12039
|
+
} else if (!stringPart.includes("&") && !stringPart.includes("'")) {
|
|
12040
|
+
classValue = `'${stringPart}'`;
|
|
12041
|
+
} else {
|
|
12042
|
+
classValue = `{${JSON.stringify(stringPart)}}`;
|
|
12043
|
+
}
|
|
12006
12044
|
}
|
|
12007
12045
|
attrs.splice(0, 0, [" ", [className, ["=", classValue]]]);
|
|
12008
12046
|
}
|
|
@@ -12910,8 +12948,29 @@ var require_parser = __commonJS({
|
|
|
12910
12948
|
return $EVENT_C(ctx, state, "TypeUnaryOp", TypeUnaryOp$$);
|
|
12911
12949
|
}
|
|
12912
12950
|
var TypeIndexedAccess$0 = $S(OpenBracket, $E(Type), __, CloseBracket);
|
|
12951
|
+
var TypeIndexedAccess$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral, IntegerLiteral)), function($skip, $loc, $0, $1, $2) {
|
|
12952
|
+
var dot = $1;
|
|
12953
|
+
var literal = $2;
|
|
12954
|
+
const open = { ...dot, token: "[" };
|
|
12955
|
+
return [
|
|
12956
|
+
open,
|
|
12957
|
+
literal,
|
|
12958
|
+
"]"
|
|
12959
|
+
];
|
|
12960
|
+
});
|
|
12961
|
+
var TypeIndexedAccess$2 = $TS($S(CoffeePrototypeEnabled, DoubleColon, $E(IdentifierName)), function($skip, $loc, $0, $1, $2, $3) {
|
|
12962
|
+
var p = $2;
|
|
12963
|
+
var id = $3;
|
|
12964
|
+
const open = { ...p, token: '["' };
|
|
12965
|
+
return [
|
|
12966
|
+
open,
|
|
12967
|
+
id,
|
|
12968
|
+
'"]'
|
|
12969
|
+
];
|
|
12970
|
+
});
|
|
12971
|
+
var TypeIndexedAccess$$ = [TypeIndexedAccess$0, TypeIndexedAccess$1, TypeIndexedAccess$2];
|
|
12913
12972
|
function TypeIndexedAccess(ctx, state) {
|
|
12914
|
-
return $
|
|
12973
|
+
return $EVENT_C(ctx, state, "TypeIndexedAccess", TypeIndexedAccess$$);
|
|
12915
12974
|
}
|
|
12916
12975
|
var UnknownAlias$0 = $TV($EXPECT($L211, 'UnknownAlias "???"'), function($skip, $loc, $0, $1) {
|
|
12917
12976
|
return { $loc, token: "unknown" };
|
|
@@ -14128,6 +14187,7 @@ var require_parser = __commonJS({
|
|
|
14128
14187
|
exports.BareNestedBlock = BareNestedBlock;
|
|
14129
14188
|
exports.BareBlock = BareBlock;
|
|
14130
14189
|
exports.ThenClause = ThenClause;
|
|
14190
|
+
exports.BracedThenClause = BracedThenClause;
|
|
14131
14191
|
exports.BracedOrEmptyBlock = BracedOrEmptyBlock;
|
|
14132
14192
|
exports.NoCommaBracedOrEmptyBlock = NoCommaBracedOrEmptyBlock;
|
|
14133
14193
|
exports.NoPostfixBracedOrEmptyBlock = NoPostfixBracedOrEmptyBlock;
|
|
@@ -14707,7 +14767,7 @@ function gen(node, options) {
|
|
|
14707
14767
|
return "";
|
|
14708
14768
|
}
|
|
14709
14769
|
if (node.type === "Error") {
|
|
14710
|
-
options.errors
|
|
14770
|
+
options.errors ??= [];
|
|
14711
14771
|
options.errors.push(node);
|
|
14712
14772
|
return "";
|
|
14713
14773
|
}
|
|
@@ -15104,9 +15164,7 @@ remapPosition = function(position, sourcemapLines) {
|
|
|
15104
15164
|
|
|
15105
15165
|
// source/state-cache.civet
|
|
15106
15166
|
var StateCache = class {
|
|
15107
|
-
|
|
15108
|
-
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
15109
|
-
}
|
|
15167
|
+
cache = /* @__PURE__ */ new Map();
|
|
15110
15168
|
get(key) {
|
|
15111
15169
|
return this.cache.get(key[0])?.get(key[1])?.get(key[2])?.get(key[3]);
|
|
15112
15170
|
}
|
|
@@ -15192,7 +15250,7 @@ function compile(src, options) {
|
|
|
15192
15250
|
} else {
|
|
15193
15251
|
options = { ...options };
|
|
15194
15252
|
}
|
|
15195
|
-
options.parseOptions
|
|
15253
|
+
options.parseOptions ??= {};
|
|
15196
15254
|
const filename = options.filename || "unknown";
|
|
15197
15255
|
if (filename.endsWith(".coffee") && !/^(#![^\r\n]*(\r\n|\n|\r))?\s*['"]civet/.test(src)) {
|
|
15198
15256
|
options.parseOptions.coffeeCompat = true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.68",
|
|
5
5
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.mjs",
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
"unplugin": "^1.6.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@danielx/civet": "0.6.
|
|
73
|
+
"@danielx/civet": "0.6.64",
|
|
74
74
|
"@danielx/hera": "^0.8.11",
|
|
75
75
|
"@prettier/sync": "^0.3.0",
|
|
76
76
|
"@types/assert": "^1.5.6",
|
|
77
77
|
"@types/mocha": "^9.1.1",
|
|
78
78
|
"@types/node": "^20.5.1",
|
|
79
79
|
"c8": "^7.12.0",
|
|
80
|
-
"esbuild": "0.
|
|
80
|
+
"esbuild": "0.20.0",
|
|
81
81
|
"marked": "^4.2.4",
|
|
82
82
|
"mocha": "^10.0.0",
|
|
83
83
|
"prettier": "^3.1.1",
|